We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 51113cc commit a7704d2Copy full SHA for a7704d2
include/boost/decimal/detail/cmath/abs.hpp
@@ -22,7 +22,14 @@ BOOST_DECIMAL_EXPORT template <typename T>
22
constexpr auto abs BOOST_DECIMAL_PREVENT_MACRO_SUBSTITUTION (const T rhs) noexcept
23
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, T)
24
{
25
- return signbit(rhs) ? -rhs : rhs;
+ if (BOOST_DECIMAL_LIKELY(!isnan(rhs)))
26
+ {
27
+ return signbit(rhs) ? -rhs : rhs;
28
+ }
29
+ else
30
31
+ return issignaling(rhs) ? nan_conversion(rhs) : rhs;
32
33
}
34
35
} // namespace decimal
0 commit comments