Skip to content

Commit 18950e8

Browse files
committed
std.fmt.parse_float: disable failing aarch64 test from LLVM 14
See #12027
1 parent 222ea69 commit 18950e8

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

lib/std/fmt/parse_float.zig

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub const parseFloat = @import("parse_float/parse_float.zig").parseFloat;
22
pub const ParseFloatError = @import("parse_float/parse_float.zig").ParseFloatError;
33

4+
const builtin = @import("builtin");
45
const std = @import("std");
56
const math = std.math;
67
const testing = std.testing;
@@ -14,8 +15,6 @@ const epsilon = 1e-7;
1415

1516
test "fmt.parseFloat" {
1617
inline for ([_]type{ f16, f32, f64, f128 }) |T| {
17-
const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
18-
1918
try testing.expectError(error.InvalidCharacter, parseFloat(T, ""));
2019
try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1"));
2120
try testing.expectError(error.InvalidCharacter, parseFloat(T, "1abc"));
@@ -40,10 +39,6 @@ test "fmt.parseFloat" {
4039
try expectEqual(try parseFloat(T, "1e-5000"), 0);
4140
try expectEqual(try parseFloat(T, "1e+5000"), std.math.inf(T));
4241

43-
try expectEqual(@bitCast(Z, try parseFloat(T, "nAn")), @bitCast(Z, std.math.nan(T)));
44-
try expectEqual(try parseFloat(T, "inF"), std.math.inf(T));
45-
try expectEqual(try parseFloat(T, "-INF"), -std.math.inf(T));
46-
4742
try expectEqual(try parseFloat(T, "0.4e0066999999999999999999999999999999999999999999999999999"), std.math.inf(T));
4843
try expect(approxEqAbs(T, try parseFloat(T, "0_1_2_3_4_5_6.7_8_9_0_0_0e0_0_1_0"), @as(T, 123456.789000e10), epsilon));
4944

@@ -74,6 +69,23 @@ test "fmt.parseFloat" {
7469
}
7570
}
7671

72+
test "fmt.parseFloat nan and inf" {
73+
if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
74+
builtin.cpu.arch == .aarch64)
75+
{
76+
// https://github.com/ziglang/zig/issues/12027
77+
return error.SkipZigTest;
78+
}
79+
80+
inline for ([_]type{ f16, f32, f64, f128 }) |T| {
81+
const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
82+
83+
try expectEqual(@bitCast(Z, try parseFloat(T, "nAn")), @bitCast(Z, std.math.nan(T)));
84+
try expectEqual(try parseFloat(T, "inF"), std.math.inf(T));
85+
try expectEqual(try parseFloat(T, "-INF"), -std.math.inf(T));
86+
}
87+
}
88+
7789
test "fmt.parseFloat #11169" {
7890
try expectEqual(try parseFloat(f128, "9007199254740993.0"), 9007199254740993.0);
7991
}

0 commit comments

Comments
 (0)