aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math.zig
diff options
context:
space:
mode:
authorSean <69403556+SeanTheGleaming@users.noreply.github.com>2024-03-29 05:33:57 -0400
committerGitHub <noreply@github.com>2024-03-29 09:33:57 +0000
commita2df84d0ffe3b7bce96f55a5d7063630aac75116 (patch)
treeb4ce817da6d3edf99422ebbcf72eb30540f6f4ea /lib/std/math.zig
parent2d443cdabf4fc3af8f325adc4b9a96c1f41005f0 (diff)
downloadzig-a2df84d0ffe3b7bce96f55a5d7063630aac75116.tar.gz
zig-a2df84d0ffe3b7bce96f55a5d7063630aac75116.zip
std.math: rework modf
- Changed `modf_result` to `Modf` to better fit naming conventions - Reworked `modf` to be far simpler and support all floating point types (as well as vectors) (I have done benchmarks and can confirm that the performance is roughly equivalent to the old implementation) - Added more descriptive tests for modf - Deprecated `modf32_result` and `modf64_result` in favor of `Modf(f32)` and `Modf(f64)` respectively
Diffstat (limited to 'lib/std/math.zig')
-rw-r--r--lib/std/math.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig
index 7524b8d2f5..19dd82ec67 100644
--- a/lib/std/math.zig
+++ b/lib/std/math.zig
@@ -112,6 +112,8 @@ pub const qnan_f80 = @compileError("Deprecated: use `nan(f80)` instead");
pub const qnan_u128 = @compileError("Deprecated: use `@as(u128, @bitCast(nan(f128)))` instead");
pub const qnan_f128 = @compileError("Deprecated: use `nan(f128)` instead");
pub const epsilon = @compileError("Deprecated: use `floatEps` instead");
+pub const modf32_result = @compileError("Deprecated: use `Modf(f32)` instead");
+pub const modf64_result = @compileError("Deprecated: use `Modf(f64)` instead");
/// Performs an approximate comparison of two floating point values `x` and `y`.
/// Returns true if the absolute difference between them is less or equal than
@@ -255,8 +257,7 @@ pub const isSignalNan = @import("math/isnan.zig").isSignalNan;
pub const frexp = @import("math/frexp.zig").frexp;
pub const Frexp = @import("math/frexp.zig").Frexp;
pub const modf = @import("math/modf.zig").modf;
-pub const modf32_result = @import("math/modf.zig").modf32_result;
-pub const modf64_result = @import("math/modf.zig").modf64_result;
+pub const Modf = @import("math/modf.zig").Modf;
pub const copysign = @import("math/copysign.zig").copysign;
pub const isFinite = @import("math/isfinite.zig").isFinite;
pub const isInf = @import("math/isinf.zig").isInf;
@@ -418,8 +419,7 @@ test {
_ = frexp;
_ = Frexp;
_ = modf;
- _ = modf32_result;
- _ = modf64_result;
+ _ = Modf;
_ = copysign;
_ = isFinite;
_ = isInf;