File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -141,13 +141,16 @@ compute_float(am_pow_t q, am_mant_t w) noexcept {
141141 // branchless approach: value128 product = compute_product(q, w); but in
142142 // practice, we can win big with the compute_product_approximation if its
143143 // additional branch is easily predicted. Which is best is data specific.
144- auto const upperbit = product.high >> 63 ;
145- auto const shift = upperbit + 64 - binary::mantissa_explicit_bits () - 3 ;
144+ am_pow_t const upperbit = product.high >> 63 ;
145+ am_pow_t const shift = upperbit + 64 - binary::mantissa_explicit_bits () - 3 ;
146146
147147 // Shift right the mantissa to the correct position
148148 answer.mantissa = product.high >> shift;
149149
150150 answer.power2 = detail::power (q) + upperbit - lz - binary::minimum_exponent ();
151+
152+ // Now, we need to round the mantissa correctly.
153+
151154 if (answer.power2 <= 0 ) { // we have a subnormal or very small value.
152155 // Here have that answer.power2 <= 0 so -answer.power2 >= 0
153156 if (-answer.power2 + 1 >=
You can’t perform that action at this time.
0 commit comments