aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2025-06-14 14:32:11 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2025-06-15 14:15:18 -0400
commit6b41beb370ce62b4381396e0543e6eb7f70b18cf (patch)
tree62ab8274799668635dc2f2fe236f081aea731eef /lib/std/math.zig
parent13392ad33f25649159048757d54fd6d8cf6d1887 (diff)
downloadzig-6b41beb370ce62b4381396e0543e6eb7f70b18cf.tar.gz
zig-6b41beb370ce62b4381396e0543e6eb7f70b18cf.zip
big.int: implement float conversions
These conversion routines accept a `round` argument to control how the result is rounded and return whether the result is exact. Most callers wanted this functionality and had hacks around it being missing. Also delete `std.math.big.rational` because it was only being used for float conversion, and using rationals for that is a lot more complex than necessary. It also required an allocator, whereas the new integer routines only need to be passed enough memory to store the result.
Diffstat (limited to 'lib/std/math.zig')
-rw-r--r--lib/std/math.zig1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig
index 5ffa7f0509..1cd9a83a14 100644
--- a/lib/std/math.zig
+++ b/lib/std/math.zig
@@ -45,6 +45,7 @@ pub const rad_per_deg = 0.017453292519943295769236907684886127134428718885417254
/// 180.0/pi
pub const deg_per_rad = 57.295779513082320876798154814105170332405472466564321549160243861;
+pub const FloatRepr = float.FloatRepr;
pub const floatExponentBits = float.floatExponentBits;
pub const floatMantissaBits = float.floatMantissaBits;
pub const floatFractionalBits = float.floatFractionalBits;