aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fmt/parse_float
diff options
context:
space:
mode:
authorMarc Tiehuis <marc@tiehu.is>2025-06-08 14:32:16 +1200
committerAndrew Kelley <andrew@ziglang.org>2025-06-08 17:57:37 -0400
commitcffa98eef54568bf43cbbe14a3cbbf972a2c7a7a (patch)
tree805c9325a460680e752d469fe04337026221d73a /lib/std/fmt/parse_float
parent201c0f54a597a53d04c782687c903cd5ea177066 (diff)
downloadzig-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.zig2
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);