File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
include/boost/decimal/detail Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,12 @@ 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- if (expval > 0 )
54+
55+ if (std::abs (expval) >= 19 )
56+ {
57+ result = 0 ;
58+ }
59+ else if (expval > 0 )
5560 {
5661 result *= detail::pow10<Conversion_Type>(static_cast <Conversion_Type>(expval));
5762 }
@@ -88,7 +93,12 @@ constexpr auto to_integral_128(Decimal val) noexcept
8893
8994 auto sig {val.full_significand ()};
9095 auto expval {val.biased_exponent ()};
91- if (expval > 0 )
96+
97+ if (std::abs (expval) >= 38 )
98+ {
99+ sig = 0 ;
100+ }
101+ else if (expval > 0 )
92102 {
93103 sig *= detail::pow10<detail::uint128>(expval);
94104 }
You can’t perform that action at this time.
0 commit comments