1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix math functions

This commit is contained in:
bolero-MURAKAMI 2013-05-06 00:22:08 +09:00
parent fccb16687b
commit 7794e56192
27 changed files with 342 additions and 102 deletions

View file

@ -18,8 +18,8 @@ namespace sprout {
inline SPROUT_CONSTEXPR sprout::pair<T, T>
frac_int_impl(T x, T ipart) {
typedef sprout::pair<T, T> type;
return x == std::numeric_limits<T>::infinity() || x == -std::numeric_limits<T>::infinity() ? type(sprout::math::copysign(T(0), x), ipart)
: sprout::math::isnan(x) ? type(std::numeric_limits<T>::quiet_NaN(), ipart)
return sprout::math::isnan(x) ? type(x, ipart)
: x == std::numeric_limits<T>::infinity() || x == -std::numeric_limits<T>::infinity() ? type(sprout::math::copysign(T(0), x), ipart)
: x == 0 ? type(x, ipart)
: x == ipart ? type(T(0) * x, ipart)
: type(sprout::math::copysign(x - ipart, x), ipart)