1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix copysign for clang

This commit is contained in:
bolero-MURAKAMI 2014-03-19 19:50:00 +09:00
parent 5527449e26
commit 01efe1e793
9 changed files with 45 additions and 13 deletions

View file

@ -11,7 +11,7 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/math/detail/config.hpp>
#include <sprout/math/isnan.hpp>
#include <sprout/math/copysign.hpp>
#include <sprout/type_traits/enabler_if.hpp>
namespace sprout {
@ -29,7 +29,7 @@ namespace sprout {
// signbit
//
// issue:
// [ !SPROUT_USE_BUILTIN_CMATH_FUNCTION ]
// [ !(SPROUT_USE_BUILTIN_CMATH_FUNCTION || SPROUT_USE_BUILTIN_COPYSIGN_FUNCTION) ]
// signbit(-0) returns false .
// # returns true . ( same as signbit(+0) )
// signbit(-NaN) returns false .
@ -44,8 +44,10 @@ namespace sprout {
return
#if SPROUT_USE_BUILTIN_CMATH_FUNCTION
sprout::math::detail::builtin_signbit(x)
#elif SPROUT_USE_BUILTIN_COPYSIGN_FUNCTION
sprout::math::copysign(FloatType(1), x) < FloatType(0)
#else
!sprout::math::isnan(x) && x < 0
sprout::math::detail::broken_signbit(x)
#endif
;
}