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-02-14 18:02:43 +09:00
parent 5d809ef5c9
commit fa1d769bdf
76 changed files with 582 additions and 169 deletions

View file

@ -1,6 +1,7 @@
#ifndef SPROUT_MATH_EXP10_HPP
#define SPROUT_MATH_EXP10_HPP
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/exp.hpp>
@ -16,7 +17,11 @@ namespace sprout {
>
inline SPROUT_CONSTEXPR FloatType
exp10(FloatType x) {
return sprout::math::exp(x * sprout::math::ln_ten<FloatType>());
return x == 0 ? FloatType(1)
: x == -std::numeric_limits<FloatType>::infinity() ? FloatType(0)
: x == std::numeric_limits<FloatType>::infinity() ? std::numeric_limits<FloatType>::infinity()
: sprout::math::exp(x * sprout::math::ln_ten<FloatType>())
;
}
template<