aboutsummaryrefslogtreecommitdiff
path: root/std/math/log1p.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-05-26 14:57:53 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-05-26 14:57:53 -0400
commit7fa97b752e167de6df9a8a76999456d2c199b345 (patch)
treed05c10a10132d99d402d3912d626f84cedb27ceb /std/math/log1p.zig
parent8efb3f5e197edf2debebf0557c74fef2541cc117 (diff)
downloadzig-7fa97b752e167de6df9a8a76999456d2c199b345.tar.gz
zig-7fa97b752e167de6df9a8a76999456d2c199b345.zip
add strict float mode to some math functions
fixes a test failure for acosh32
Diffstat (limited to 'std/math/log1p.zig')
-rw-r--r--std/math/log1p.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/std/math/log1p.zig b/std/math/log1p.zig
index 4616a2f2ba..0a43e121ab 100644
--- a/std/math/log1p.zig
+++ b/std/math/log1p.zig
@@ -6,6 +6,7 @@
// - log1p(x) = nan if x < -1
// - log1p(nan) = nan
+const builtin = @import("builtin");
const std = @import("../index.zig");
const math = std.math;
const assert = std.debug.assert;
@@ -20,6 +21,8 @@ pub fn log1p(x: var) @typeOf(x) {
}
fn log1p_32(x: f32) f32 {
+ @setFloatMode(this, builtin.FloatMode.Strict);
+
const ln2_hi = 6.9313812256e-01;
const ln2_lo = 9.0580006145e-06;
const Lg1: f32 = 0xaaaaaa.0p-24;
@@ -96,6 +99,8 @@ fn log1p_32(x: f32) f32 {
}
fn log1p_64(x: f64) f64 {
+ @setFloatMode(this, builtin.FloatMode.Strict);
+
const ln2_hi: f64 = 6.93147180369123816490e-01;
const ln2_lo: f64 = 1.90821492927058770002e-10;
const Lg1: f64 = 6.666666666666735130e-01;