std: stop relying on precision-losing coercions

This commit is contained in:
mlugg
2025-07-31 10:56:49 +01:00
parent e664bf4d81
commit 64bf8bb146
5 changed files with 29 additions and 25 deletions

View File

@@ -2774,11 +2774,11 @@ test "std.zon parse float" {
// Test big integers
try std.testing.expectEqual(
@as(f32, 36893488147419103231),
@as(f32, 36893488147419103231.0),
try fromSlice(f32, gpa, "36893488147419103231", null, .{}),
);
try std.testing.expectEqual(
@as(f32, -36893488147419103231),
@as(f32, -36893488147419103231.0),
try fromSlice(f32, gpa, "-36893488147419103231", null, .{}),
);
try std.testing.expectEqual(@as(f128, 0x1ffffffffffffffff), try fromSlice(
@@ -2788,7 +2788,7 @@ test "std.zon parse float" {
null,
.{},
));
try std.testing.expectEqual(@as(f32, 0x1ffffffffffffffff), try fromSlice(
try std.testing.expectEqual(@as(f32, @floatFromInt(0x1ffffffffffffffff)), try fromSlice(
f32,
gpa,
"0x1ffffffffffffffff",