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-04-26 00:25:35 +09:00
parent dad3acceea
commit 2e2b6c96ab
30 changed files with 121 additions and 84 deletions

View file

@ -1,11 +1,13 @@
#ifndef SPROUT_MATH_FLOAT_EXPONENT_HPP
#define SPROUT_MATH_FLOAT_EXPONENT_HPP
#include <climits>
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/ilogb.hpp>
#include <sprout/math/isnan.hpp>
#include <sprout/type_traits/enabler_if.hpp>
namespace sprout {
@ -18,10 +20,11 @@ namespace sprout {
inline SPROUT_CONSTEXPR int
float_exponent(FloatType x) {
return x == 0 ? 0
: x == std::numeric_limits<FloatType>::infinity() || x == -std::numeric_limits<FloatType>::infinity() ? 0
: sprout::math::isnan(x) ? FP_ILOGBNAN
: sprout::math::ilogb(x) + 1
;
}
template<
typename IntType,
typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler