| author | |
| committer | |
| log | cffa98eef54568bf43cbbe14a3cbbf972a2c7a7a |
| tree | 805c9325a460680e752d469fe04337026221d73a |
| parent | 201c0f54a597a53d04c782687c903cd5ea177066 |
Closes #24111.2 files changed, 4 insertions(+), 1 deletions(-)
lib/std/fmt/parse_float.zig+3| ... | ... | @@ -159,6 +159,9 @@ test "hex.special" { |
| 159 | 159 | try testing.expect(math.isPositiveInf(try parseFloat(f32, "iNf"))); |
| 160 | 160 | try testing.expect(math.isPositiveInf(try parseFloat(f32, "+Inf"))); |
| 161 | 161 | try testing.expect(math.isNegativeInf(try parseFloat(f32, "-iNf"))); |
| 162 | ||
| 163 | try testing.expect(math.isPositiveInf(try parseFloat(f32, "0x9999p9999"))); | |
| 164 | try testing.expect(math.isNegativeInf(try parseFloat(f32, "-0x9999p9999"))); | |
| 162 | 165 | } |
| 163 | 166 | |
| 164 | 167 | test "hex.zero" { |
lib/std/fmt/parse_float/convert_hex.zig+1-1| ... | ... | @@ -78,7 +78,7 @@ pub fn convertHex(comptime T: type, n_: Number(T)) T { |
| 78 | 78 | |
| 79 | 79 | // Infinity and range error |
| 80 | 80 | if (n.exponent > max_exp) { |
| 81 | return math.inf(T); | |
| 81 | return if (n.negative) -math.inf(T) else math.inf(T); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | var bits = n.mantissa & ((1 << mantissa_bits) - 1); |