add sprout/math/comparison.hpp

This commit is contained in:
bolero-MURAKAMI 2012-07-06 23:10:49 +09:00
parent d51bd06eda
commit 1c65d59971
20 changed files with 379 additions and 109 deletions

View file

@ -8,6 +8,7 @@
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/isinf.hpp>
#include <sprout/math/equal_to.hpp>
#include <sprout/type_traits/enabler_if.hpp>
namespace sprout {
@ -16,7 +17,7 @@ namespace sprout {
template<typename FloatType>
inline SPROUT_CONSTEXPR FloatType
ceil_impl(FloatType x, FloatType x0) {
return x - x0 < std::numeric_limits<FloatType>::epsilon() ? x0
return sprout::math::equal_to(x, x0) ? x0
: x0 + 1
;
}