fix math functions

This commit is contained in:
bolero-MURAKAMI 2013-02-14 18:02:43 +09:00
parent 5d809ef5c9
commit fa1d769bdf
76 changed files with 582 additions and 169 deletions

View file

@ -40,7 +40,8 @@ namespace sprout {
>
inline SPROUT_CONSTEXPR To
itrunc(FloatType x) {
return std::numeric_limits<To>::max() < x || std::numeric_limits<To>::min() > x
return x == 0 ? To(0)
: std::numeric_limits<To>::max() < x || std::numeric_limits<To>::min() > x
? SPROUT_MATH_THROW_LARGE_FLOAT_ROUNDING(std::domain_error("itrunc: large float rounding."), static_cast<To>(x))
: static_cast<To>(x)
;