mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-04 14:14:09 +00:00
fix math functions
This commit is contained in:
parent
fccb16687b
commit
7794e56192
27 changed files with 342 additions and 102 deletions
|
@ -4,6 +4,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>
|
||||
|
||||
|
@ -16,7 +17,10 @@ namespace sprout {
|
|||
>
|
||||
inline SPROUT_CONSTEXPR FloatType
|
||||
fabs(FloatType x) {
|
||||
return sprout::math::copysign(x, FloatType(0));
|
||||
return sprout::math::isnan(x) ? std::numeric_limits<FloatType>::quiet_NaN()
|
||||
: x == 0 ? FloatType(0)
|
||||
: sprout::math::copysign(x, FloatType(0))
|
||||
;
|
||||
}
|
||||
template<
|
||||
typename IntType,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue