Skip to content

Commit a2ca370

Browse files
committed
Replace std::abs with constexpr version
1 parent e50c56e commit a2ca370

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/boost/decimal/detail/to_integral.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ constexpr auto to_integral(Decimal val) noexcept
5151

5252
auto result {static_cast<Conversion_Type>(val.full_significand())};
5353
auto expval {val.biased_exponent()};
54+
const auto abs_exp_val {detail::make_positive_unsigned(expval)};
5455

55-
if (std::abs(expval) >= 19)
56+
if (abs_exp_val >= 19)
5657
{
5758
result = 0;
5859
}
@@ -93,8 +94,9 @@ constexpr auto to_integral_128(Decimal val) noexcept
9394

9495
auto sig {val.full_significand()};
9596
auto expval {val.biased_exponent()};
97+
const auto abs_exp_val {detail::make_positive_unsigned(expval)};
9698

97-
if (std::abs(expval) >= 38)
99+
if (abs_exp_val >= 38)
98100
{
99101
sig = 0;
100102
}

0 commit comments

Comments
 (0)