1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix math::is_odd for a negative argument

I think that sprout::math::is_odd(-1) should be true.

It also fixes math::pow for a case that x is a negative and y is a negative odd integer.

cf. http://melpon.org/wandbox/permlink/XVKea2I6CdVJCbZX
This commit is contained in:
Mitsuru Kariya 2014-07-16 01:03:20 +09:00
parent 5c10e4d85c
commit 191867afe0

View file

@ -33,7 +33,7 @@ namespace sprout {
inline SPROUT_CONSTEXPR bool
is_odd(FloatType x) {
return sprout::math::isfinite(x)
&& sprout::math::detail::is_odd_unchecked(x)
&& sprout::math::detail::is_odd_unchecked(x < 0 ? -x : x)
;
}
} // namespace math