| author | |
| committer | |
| log | 7fa97b752e167de6df9a8a76999456d2c199b345 |
| tree | d05c10a10132d99d402d3912d626f84cedb27ceb |
| parent | 8efb3f5e197edf2debebf0557c74fef2541cc117 |
fixes a test failure for acosh324 files changed, 13 insertions(+), 2 deletions(-)
std/math/acosh.zig+4| ... | @@ -19,6 +19,8 @@ pub fn acosh(x: var) @typeOf(x) { | ... | @@ -19,6 +19,8 @@ pub fn acosh(x: var) @typeOf(x) { |
| 19 | 19 | ||
| 20 | // acosh(x) = log(x + sqrt(x * x - 1)) | 20 | // acosh(x) = log(x + sqrt(x * x - 1)) |
| 21 | fn acosh32(x: f32) f32 { | 21 | fn acosh32(x: f32) f32 { |
| 22 | @setFloatMode(this, builtin.FloatMode.Strict); | ||
| 23 | |||
| 22 | const u = @bitCast(u32, x); | 24 | const u = @bitCast(u32, x); |
| 23 | const i = u & 0x7FFFFFFF; | 25 | const i = u & 0x7FFFFFFF; |
| 24 | 26 | ||
| ... | @@ -37,6 +39,8 @@ fn acosh32(x: f32) f32 { | ... | @@ -37,6 +39,8 @@ fn acosh32(x: f32) f32 { |
| 37 | } | 39 | } |
| 38 | 40 | ||
| 39 | fn acosh64(x: f64) f64 { | 41 | fn acosh64(x: f64) f64 { |
| 42 | @setFloatMode(this, builtin.FloatMode.Strict); | ||
| 43 | |||
| 40 | const u = @bitCast(u64, x); | 44 | const u = @bitCast(u64, x); |
| 41 | const e = (u >> 52) & 0x7FF; | 45 | const e = (u >> 52) & 0x7FF; |
| 42 | 46 |
std/math/isnan.zig+2-2| ... | @@ -19,8 +19,8 @@ pub fn isNan(x: var) bool { | ... | @@ -19,8 +19,8 @@ pub fn isNan(x: var) bool { |
| 19 | } | 19 | } |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | // Note: A signalling nan is identical to a standard right now by may have a different bit | 22 | /// Note: A signalling nan is identical to a standard nan right now but may have a different bit |
| 23 | // representation in the future when required. | 23 | /// representation in the future when required. |
| 24 | pub fn isSignalNan(x: var) bool { | 24 | pub fn isSignalNan(x: var) bool { |
| 25 | return isNan(x); | 25 | return isNan(x); |
| 26 | } | 26 | } |
std/math/log1p.zig+5| ... | @@ -6,6 +6,7 @@ | ... | @@ -6,6 +6,7 @@ |
| 6 | // - log1p(x) = nan if x < -1 | 6 | // - log1p(x) = nan if x < -1 |
| 7 | // - log1p(nan) = nan | 7 | // - log1p(nan) = nan |
| 8 | 8 | ||
| 9 | const builtin = @import("builtin"); | ||
| 9 | const std = @import("../index.zig"); | 10 | const std = @import("../index.zig"); |
| 10 | const math = std.math; | 11 | const math = std.math; |
| 11 | const assert = std.debug.assert; | 12 | const assert = std.debug.assert; |
| ... | @@ -20,6 +21,8 @@ pub fn log1p(x: var) @typeOf(x) { | ... | @@ -20,6 +21,8 @@ pub fn log1p(x: var) @typeOf(x) { |
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | fn log1p_32(x: f32) f32 { | 23 | fn log1p_32(x: f32) f32 { |
| 24 | @setFloatMode(this, builtin.FloatMode.Strict); | ||
| 25 | |||
| 23 | const ln2_hi = 6.9313812256e-01; | 26 | const ln2_hi = 6.9313812256e-01; |
| 24 | const ln2_lo = 9.0580006145e-06; | 27 | const ln2_lo = 9.0580006145e-06; |
| 25 | const Lg1: f32 = 0xaaaaaa.0p-24; | 28 | const Lg1: f32 = 0xaaaaaa.0p-24; |
| ... | @@ -96,6 +99,8 @@ fn log1p_32(x: f32) f32 { | ... | @@ -96,6 +99,8 @@ fn log1p_32(x: f32) f32 { |
| 96 | } | 99 | } |
| 97 | 100 | ||
| 98 | fn log1p_64(x: f64) f64 { | 101 | fn log1p_64(x: f64) f64 { |
| 102 | @setFloatMode(this, builtin.FloatMode.Strict); | ||
| 103 | |||
| 99 | const ln2_hi: f64 = 6.93147180369123816490e-01; | 104 | const ln2_hi: f64 = 6.93147180369123816490e-01; |
| 100 | const ln2_lo: f64 = 1.90821492927058770002e-10; | 105 | const ln2_lo: f64 = 1.90821492927058770002e-10; |
| 101 | const Lg1: f64 = 6.666666666666735130e-01; | 106 | const Lg1: f64 = 6.666666666666735130e-01; |
std/special/builtin.zig+2| ... | @@ -201,6 +201,8 @@ fn isNan(comptime T: type, bits: T) bool { | ... | @@ -201,6 +201,8 @@ fn isNan(comptime T: type, bits: T) bool { |
| 201 | // behaviour. Most intermediate i32 values are changed to u32 where appropriate but there are | 201 | // behaviour. Most intermediate i32 values are changed to u32 where appropriate but there are |
| 202 | // potentially some edge cases remaining that are not handled in the same way. | 202 | // potentially some edge cases remaining that are not handled in the same way. |
| 203 | export fn sqrt(x: f64) f64 { | 203 | export fn sqrt(x: f64) f64 { |
| 204 | @setFloatMode(this, builtin.FloatMode.Strict); | ||
| 205 | |||
| 204 | const tiny: f64 = 1.0e-300; | 206 | const tiny: f64 = 1.0e-300; |
| 205 | const sign: u32 = 0x80000000; | 207 | const sign: u32 = 0x80000000; |
| 206 | const u = @bitCast(u64, x); | 208 | const u = @bitCast(u64, x); |