diff options
| author | Marc Tiehuis <marc@tiehu.is> | 2025-06-08 14:32:16 +1200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-06-08 17:57:37 -0400 |
| commit | cffa98eef54568bf43cbbe14a3cbbf972a2c7a7a (patch) | |
| tree | 805c9325a460680e752d469fe04337026221d73a /lib/std/fmt/parse_float | |
| parent | 201c0f54a597a53d04c782687c903cd5ea177066 (diff) | |
| download | zig-cffa98eef54568bf43cbbe14a3cbbf972a2c7a7a.tar.gz zig-cffa98eef54568bf43cbbe14a3cbbf972a2c7a7a.zip | |
std.fmt.parseFloat: fix hex-float negative inf
Closes #24111.
Diffstat (limited to 'lib/std/fmt/parse_float')
| -rw-r--r-- | lib/std/fmt/parse_float/convert_hex.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/fmt/parse_float/convert_hex.zig b/lib/std/fmt/parse_float/convert_hex.zig index d2063f1c00..2099eb1626 100644 --- a/lib/std/fmt/parse_float/convert_hex.zig +++ b/lib/std/fmt/parse_float/convert_hex.zig @@ -78,7 +78,7 @@ pub fn convertHex(comptime T: type, n_: Number(T)) T { // Infinity and range error if (n.exponent > max_exp) { - return math.inf(T); + return if (n.negative) -math.inf(T) else math.inf(T); } var bits = n.mantissa & ((1 << mantissa_bits) - 1); |
