diff options
| author | viri <hi@viri.moe> | 2022-04-06 20:49:05 -0600 |
|---|---|---|
| committer | viri <hi@viri.moe> | 2022-04-07 05:04:38 -0600 |
| commit | e46c61250332e615afc5aed6e4ebe57b8e6713eb (patch) | |
| tree | 5ffbc2acac6c03becd253c7d4308eb33a4721025 /lib/std/fmt.zig | |
| parent | 5d6a5a123676ada3ccd229f31dc8855aabaf8057 (diff) | |
| download | zig-e46c61250332e615afc5aed6e4ebe57b8e6713eb.tar.gz zig-e46c61250332e615afc5aed6e4ebe57b8e6713eb.zip | |
use math/float.zig everywhere
Diffstat (limited to 'lib/std/fmt.zig')
| -rw-r--r-- | lib/std/fmt.zig | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 6d4f3a1daa..03395c024c 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -2228,8 +2228,8 @@ test "float.special" { if (builtin.target.cpu.arch != .arm) { try expectFmt("f64: -nan", "f64: {}", .{-math.nan_f64}); } - try expectFmt("f64: inf", "f64: {}", .{math.inf_f64}); - try expectFmt("f64: -inf", "f64: {}", .{-math.inf_f64}); + try expectFmt("f64: inf", "f64: {}", .{math.inf(f64)}); + try expectFmt("f64: -inf", "f64: {}", .{-math.inf(f64)}); } test "float.hexadecimal.special" { @@ -2239,8 +2239,8 @@ test "float.hexadecimal.special" { if (builtin.target.cpu.arch != .arm) { try expectFmt("f64: -nan", "f64: {x}", .{-math.nan_f64}); } - try expectFmt("f64: inf", "f64: {x}", .{math.inf_f64}); - try expectFmt("f64: -inf", "f64: {x}", .{-math.inf_f64}); + try expectFmt("f64: inf", "f64: {x}", .{math.inf(f64)}); + try expectFmt("f64: -inf", "f64: {x}", .{-math.inf(f64)}); try expectFmt("f64: 0x0.0p0", "f64: {x}", .{@as(f64, 0)}); try expectFmt("f64: -0x0.0p0", "f64: {x}", .{-@as(f64, 0)}); @@ -2252,20 +2252,20 @@ test "float.hexadecimal" { try expectFmt("f64: 0x1.5555555555555p-2", "f64: {x}", .{@as(f64, 1.0 / 3.0)}); try expectFmt("f128: 0x1.5555555555555555555555555555p-2", "f128: {x}", .{@as(f128, 1.0 / 3.0)}); - try expectFmt("f16: 0x1p-14", "f16: {x}", .{@as(f16, math.f16_min)}); - try expectFmt("f32: 0x1p-126", "f32: {x}", .{@as(f32, math.f32_min)}); - try expectFmt("f64: 0x1p-1022", "f64: {x}", .{@as(f64, math.f64_min)}); - try expectFmt("f128: 0x1p-16382", "f128: {x}", .{@as(f128, math.f128_min)}); + try expectFmt("f16: 0x1p-14", "f16: {x}", .{math.floatMin(f16)}); + try expectFmt("f32: 0x1p-126", "f32: {x}", .{math.floatMin(f32)}); + try expectFmt("f64: 0x1p-1022", "f64: {x}", .{math.floatMin(f64)}); + try expectFmt("f128: 0x1p-16382", "f128: {x}", .{math.floatMin(f128)}); - try expectFmt("f16: 0x0.004p-14", "f16: {x}", .{@as(f16, math.f16_true_min)}); - try expectFmt("f32: 0x0.000002p-126", "f32: {x}", .{@as(f32, math.f32_true_min)}); - try expectFmt("f64: 0x0.0000000000001p-1022", "f64: {x}", .{@as(f64, math.f64_true_min)}); - try expectFmt("f128: 0x0.0000000000000000000000000001p-16382", "f128: {x}", .{@as(f128, math.f128_true_min)}); + try expectFmt("f16: 0x0.004p-14", "f16: {x}", .{math.floatTrueMin(f16)}); + try expectFmt("f32: 0x0.000002p-126", "f32: {x}", .{math.floatTrueMin(f32)}); + try expectFmt("f64: 0x0.0000000000001p-1022", "f64: {x}", .{math.floatTrueMin(f64)}); + try expectFmt("f128: 0x0.0000000000000000000000000001p-16382", "f128: {x}", .{math.floatTrueMin(f128)}); - try expectFmt("f16: 0x1.ffcp15", "f16: {x}", .{@as(f16, math.f16_max)}); - try expectFmt("f32: 0x1.fffffep127", "f32: {x}", .{@as(f32, math.f32_max)}); - try expectFmt("f64: 0x1.fffffffffffffp1023", "f64: {x}", .{@as(f64, math.f64_max)}); - try expectFmt("f128: 0x1.ffffffffffffffffffffffffffffp16383", "f128: {x}", .{@as(f128, math.f128_max)}); + try expectFmt("f16: 0x1.ffcp15", "f16: {x}", .{math.floatMax(f16)}); + try expectFmt("f32: 0x1.fffffep127", "f32: {x}", .{math.floatMax(f32)}); + try expectFmt("f64: 0x1.fffffffffffffp1023", "f64: {x}", .{math.floatMax(f64)}); + try expectFmt("f128: 0x1.ffffffffffffffffffffffffffffp16383", "f128: {x}", .{math.floatMax(f128)}); } test "float.hexadecimal.precision" { |
