Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Rounding mode support for hexadecimal float parsing, with improvements to error handling #529

Merged
merged 10 commits into from
Apr 15, 2025
Prev Previous commit
Update src/math/support/hex_float.rs
  • Loading branch information
tgross35 authored Apr 15, 2025
commit 26fcd19114aae190e197142c4113918cc82ffbc3
4 changes: 2 additions & 2 deletions src/math/support/hex_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ const fn shr2_round(mut x: u128, round: Round) -> u128 {
let t = (x as u32) & 0b111;
x >>= 2;
match round {
// Look-up-table on the last three bits for when to round up
// Look-up-table on the last three bits for when to round up
Round::Nearest => x + ((0b11001000_u8 >> t) & 1) as u128,

Round::Negative => x,
Round::Zero => x,
Round::Positive => x + (t & 0b11 != 0) as u128,
Expand Down
Loading