aboutsummaryrefslogtreecommitdiff
path: root/std/math/log1p.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-12-22 00:50:30 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-12-22 00:50:30 -0500
commitd917815d8111b98dc237cbe2c723fa63018e02b1 (patch)
treece12771a86b2412ee9692ca73d3ca49abe5da3ce /std/math/log1p.zig
parent8bc523219c66427951e5339550502871547f2138 (diff)
downloadzig-d917815d8111b98dc237cbe2c723fa63018e02b1.tar.gz
zig-d917815d8111b98dc237cbe2c723fa63018e02b1.zip
explicitly return from blocks
instead of last statement being expression value closes #629
Diffstat (limited to 'std/math/log1p.zig')
-rw-r--r--std/math/log1p.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/std/math/log1p.zig b/std/math/log1p.zig
index 803726fdcc..433a7c6192 100644
--- a/std/math/log1p.zig
+++ b/std/math/log1p.zig
@@ -11,11 +11,11 @@ const assert = @import("../debug.zig").assert;
pub fn log1p(x: var) -> @typeOf(x) {
const T = @typeOf(x);
- switch (T) {
+ return switch (T) {
f32 => @inlineCall(log1p_32, x),
f64 => @inlineCall(log1p_64, x),
else => @compileError("log1p not implemented for " ++ @typeName(T)),
- }
+ };
}
fn log1p_32(x: f32) -> f32 {
@@ -91,7 +91,7 @@ fn log1p_32(x: f32) -> f32 {
const hfsq = 0.5 * f * f;
const dk = f32(k);
- s * (hfsq + R) + (dk * ln2_lo + c) - hfsq + f + dk * ln2_hi
+ return s * (hfsq + R) + (dk * ln2_lo + c) - hfsq + f + dk * ln2_hi;
}
fn log1p_64(x: f64) -> f64 {
@@ -172,7 +172,7 @@ fn log1p_64(x: f64) -> f64 {
const R = t2 + t1;
const dk = f64(k);
- s * (hfsq + R) + (dk * ln2_lo + c) - hfsq + f + dk * ln2_hi
+ return s * (hfsq + R) + (dk * ln2_lo + c) - hfsq + f + dk * ln2_hi;
}
test "math.log1p" {