Skip to content

Commit aae50cd

Browse files
committed
Fix possible loss of exp
1 parent ab556d2 commit aae50cd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/boost/decimal/decimal32_fast.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ constexpr decimal32_fast::decimal32_fast(T1 coeff, T2 exp, bool sign) noexcept
379379
exp = 0;
380380
}
381381

382-
auto biased_exp {static_cast<exponent_type>(exp + detail::bias)};
382+
auto biased_exp {static_cast<std::uint64_t>(exp + detail::bias)};
383383

384384
// Decimal32 exponent holds 8 bits
385385
if (biased_exp > detail::max_biased_exp_v<decimal32_fast> || exp > detail::max_biased_exp_v<decimal32_fast>)
@@ -1028,7 +1028,7 @@ constexpr auto div_impl(decimal32_fast lhs, decimal32_fast rhs, decimal32_fast&
10281028
<< "\nexp rhs: " << exp_rhs << std::endl;
10291029
#endif
10301030

1031-
using promoted_type = std::uint64_t;
1031+
using promoted_type = std::uint_fast64_t;
10321032

10331033
// We promote to uint64 since the significands are currently 32-bits
10341034
// By appending enough zeros to the LHS we end up finding what we need anyway

0 commit comments

Comments
 (0)