| ... | @@ -206,13 +206,11 @@ pub fn parseHexFloat(comptime T: type, s: []const u8) !T { | ... | @@ -206,13 +206,11 @@ pub fn parseHexFloat(comptime T: type, s: []const u8) !T { |
| 206 | // - we've truncated more than 0.5ULP (R=S=1) | 206 | // - we've truncated more than 0.5ULP (R=S=1) |
| 207 | // - we've truncated exactly 0.5ULP (R=1 S=0) | 207 | // - we've truncated exactly 0.5ULP (R=1 S=0) |
| 208 | // Were are going to increase the mantissa (round up) | 208 | // Were are going to increase the mantissa (round up) |
| 209 | var exactly_half = (mantissa & 0b11) == 0b10; | 209 | const guard_bit_and_half_or_more = (mantissa & 0b110) == 0b110; |
| 210 | var more_than_half = (mantissa & 0b11) == 0b11; | | |
| 211 | mantissa >>= 2; | 210 | mantissa >>= 2; |
| 212 | var guardBit = mantissa & 1 == 1; | | |
| 213 | exponent += 2; | 211 | exponent += 2; |
| 214 | | 212 | |
| 215 | if (guardBit and (exactly_half or more_than_half)) { | 213 | if (guard_bit_and_half_or_more) { |
| 216 | mantissa += 1; | 214 | mantissa += 1; |
| 217 | } | 215 | } |
| 218 | | 216 | |