add math::copysign

fix hyperbolic and exponental functions: for special values
This commit is contained in:
bolero-MURAKAMI 2013-04-24 22:48:36 +09:00
parent a27c83e939
commit 32c3ba02d4
50 changed files with 540 additions and 216 deletions

View file

@ -23,27 +23,27 @@ namespace sprout {
return x == 0
? y < 0 ? std::numeric_limits<FloatType>::infinity()
: y > 0 ? FloatType(0)
: sprout::exp(y * sprout::log(x))
: sprout::math::exp(y * sprout::math::log(x))
: x == -1 && (y == std::numeric_limits<FloatType>::infinity() || y == -std::numeric_limits<FloatType>::infinity()) ? FloatType(1)
: x == 1 ? FloatType(1)
: y == 0 ? FloatType(1)
: y == -std::numeric_limits<FloatType>::infinity()
? x < 1 && x > -1 ? std::numeric_limits<FloatType>::infinity()
: x > 1 || x < -1 ? FloatType(0)
: sprout::exp(y * sprout::log(x))
: sprout::math::exp(y * sprout::math::log(x))
: y == std::numeric_limits<FloatType>::infinity()
? x < 1 && x > -1 ? FloatType(0)
: x > 1 || x < -1 ? std::numeric_limits<FloatType>::infinity()
: sprout::exp(y * sprout::log(x))
: sprout::math::exp(y * sprout::math::log(x))
: x == -std::numeric_limits<FloatType>::infinity()
? y < 0 ? FloatType(0)
: y > 0 ? std::numeric_limits<FloatType>::infinity()
: sprout::exp(y * sprout::log(x))
: sprout::math::exp(y * sprout::math::log(x))
: x == std::numeric_limits<FloatType>::infinity()
? y < 0 ? FloatType(0)
: y > 0 ? std::numeric_limits<FloatType>::infinity()
: sprout::exp(y * sprout::log(x))
: sprout::exp(y * sprout::log(x))
: sprout::math::exp(y * sprout::math::log(x))
: sprout::math::exp(y * sprout::math::log(x))
;
}