| ... | ... | @@ -45,6 +45,7 @@ pub const floatTrueMin = @import("math/float.zig").floatTrueMin; |
| 45 | 45 | pub const floatMin = @import("math/float.zig").floatMin; |
| 46 | 46 | pub const floatMax = @import("math/float.zig").floatMax; |
| 47 | 47 | pub const floatEps = @import("math/float.zig").floatEps; |
| 48 | pub const inf = @import("math/float.zig").inf; |
| 48 | 49 | |
| 49 | 50 | // TODO Replace with @compileError("deprecated for foobar") after 0.10.0 is released. |
| 50 | 51 | pub const f16_true_min: comptime_float = floatTrueMin(f16); // prev: 0.000000059604644775390625 |
| ... | ... | @@ -72,6 +73,15 @@ pub const f32_toint: comptime_float = 1.0 / f32_epsilon; // same as before |
| 72 | 73 | pub const f64_toint: comptime_float = 1.0 / f64_epsilon; // same as before |
| 73 | 74 | pub const f80_toint = 1.0 / f80_epsilon; // same as before |
| 74 | 75 | pub const f128_toint = 1.0 / f128_epsilon; // same as before |
| 76 | pub const inf_u16 = @bitCast(u16, inf_f16); // prev: @as(u16, 0x7C00) |
| 77 | pub const inf_f16 = inf(f16); // prev: @bitCast(f16, inf_u16) |
| 78 | pub const inf_u32 = @bitCast(u32, inf_f32); // prev: @as(u32, 0x7F800000) |
| 79 | pub const inf_f32 = inf(f32); // prev: @bitCast(f32, inf_u32) |
| 80 | pub const inf_u64 = @bitCast(u64, inf_f64); // prev: @as(u64, 0x7FF << 52) |
| 81 | pub const inf_f64 = inf(f64); // prev: @bitCast(f64, inf_u64) |
| 82 | pub const inf_f80 = inf(f80); // prev: make_f80(F80{ .fraction = 0x8000000000000000, .exp = 0x7fff }) |
| 83 | pub const inf_u128 = @bitCast(u128, inf_f128); // prev: @as(u128, 0x7fff0000000000000000000000000000) |
| 84 | pub const inf_f128 = inf(f128); // prev: @bitCast(f128, inf_u128) |
| 75 | 85 | pub const epsilon = floatEps; |
| 76 | 86 | // End of "soft deprecated" section |
| 77 | 87 | |
| ... | ... | @@ -81,28 +91,18 @@ pub const nan_f16 = @bitCast(f16, nan_u16); |
| 81 | 91 | pub const qnan_u16 = @as(u16, 0x7E00); |
| 82 | 92 | pub const qnan_f16 = @bitCast(f16, qnan_u16); |
| 83 | 93 | |
| 84 | | pub const inf_u16 = @as(u16, 0x7C00); |
| 85 | | pub const inf_f16 = @bitCast(f16, inf_u16); |
| 86 | | |
| 87 | 94 | pub const nan_u32 = @as(u32, 0x7F800001); |
| 88 | 95 | pub const nan_f32 = @bitCast(f32, nan_u32); |
| 89 | 96 | |
| 90 | 97 | pub const qnan_u32 = @as(u32, 0x7FC00000); |
| 91 | 98 | pub const qnan_f32 = @bitCast(f32, qnan_u32); |
| 92 | 99 | |
| 93 | | pub const inf_u32 = @as(u32, 0x7F800000); |
| 94 | | pub const inf_f32 = @bitCast(f32, inf_u32); |
| 95 | | |
| 96 | 100 | pub const nan_u64 = @as(u64, 0x7FF << 52) | 1; |
| 97 | 101 | pub const nan_f64 = @bitCast(f64, nan_u64); |
| 98 | 102 | |
| 99 | 103 | pub const qnan_u64 = @as(u64, 0x7ff8000000000000); |
| 100 | 104 | pub const qnan_f64 = @bitCast(f64, qnan_u64); |
| 101 | 105 | |
| 102 | | pub const inf_u64 = @as(u64, 0x7FF << 52); |
| 103 | | pub const inf_f64 = @bitCast(f64, inf_u64); |
| 104 | | |
| 105 | | pub const inf_f80 = make_f80(F80{ .fraction = 0x8000000000000000, .exp = 0x7fff }); |
| 106 | 106 | pub const nan_f80 = make_f80(F80{ .fraction = 0xA000000000000000, .exp = 0x7fff }); |
| 107 | 107 | pub const qnan_f80 = make_f80(F80{ .fraction = 0xC000000000000000, .exp = 0x7fff }); |
| 108 | 108 | |
| ... | ... | @@ -112,12 +112,8 @@ pub const nan_f128 = @bitCast(f128, nan_u128); |
| 112 | 112 | pub const qnan_u128 = @as(u128, 0x7fff8000000000000000000000000000); |
| 113 | 113 | pub const qnan_f128 = @bitCast(f128, qnan_u128); |
| 114 | 114 | |
| 115 | | pub const inf_u128 = @as(u128, 0x7fff0000000000000000000000000000); |
| 116 | | pub const inf_f128 = @bitCast(f128, inf_u128); |
| 117 | | |
| 118 | 115 | pub const nan = @import("math/nan.zig").nan; |
| 119 | 116 | pub const snan = @import("math/nan.zig").snan; |
| 120 | | pub const inf = @import("math/inf.zig").inf; |
| 121 | 117 | |
| 122 | 118 | /// Performs an approximate comparison of two floating point values `x` and `y`. |
| 123 | 119 | /// Returns true if the absolute difference between them is less or equal than |