diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-12-22 00:50:30 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-12-22 00:50:30 -0500 |
| commit | d917815d8111b98dc237cbe2c723fa63018e02b1 (patch) | |
| tree | ce12771a86b2412ee9692ca73d3ca49abe5da3ce /std/math/atanh.zig | |
| parent | 8bc523219c66427951e5339550502871547f2138 (diff) | |
| download | zig-d917815d8111b98dc237cbe2c723fa63018e02b1.tar.gz zig-d917815d8111b98dc237cbe2c723fa63018e02b1.zip | |
explicitly return from blocks
instead of last statement being expression value
closes #629
Diffstat (limited to 'std/math/atanh.zig')
| -rw-r--r-- | std/math/atanh.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/std/math/atanh.zig b/std/math/atanh.zig index 8fe5ab55a7..2f87efbbd3 100644 --- a/std/math/atanh.zig +++ b/std/math/atanh.zig @@ -9,11 +9,11 @@ const assert = @import("../debug.zig").assert; pub fn atanh(x: var) -> @typeOf(x) { const T = @typeOf(x); - switch (T) { + return switch (T) { f32 => @inlineCall(atanh_32, x), f64 => @inlineCall(atanh_64, x), else => @compileError("atanh not implemented for " ++ @typeName(T)), - } + }; } // atanh(x) = log((1 + x) / (1 - x)) / 2 = log1p(2x / (1 - x)) / 2 ~= x + x^3 / 3 + o(x^5) @@ -32,7 +32,7 @@ fn atanh_32(x: f32) -> f32 { if (u < 0x3F800000 - (32 << 23)) { // underflow if (u < (1 << 23)) { - math.forceEval(y * y) + math.forceEval(y * y); } } // |x| < 0.5 @@ -43,7 +43,7 @@ fn atanh_32(x: f32) -> f32 { y = 0.5 * math.log1p(2 * (y / (1 - y))); } - if (s != 0) -y else y + return if (s != 0) -y else y; } fn atanh_64(x: f64) -> f64 { @@ -72,7 +72,7 @@ fn atanh_64(x: f64) -> f64 { y = 0.5 * math.log1p(2 * (y / (1 - y))); } - if (s != 0) -y else y + return if (s != 0) -y else y; } test "math.atanh" { |
