aboutsummaryrefslogtreecommitdiff
path: root/std/math/tanh.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/tanh.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/tanh.zig')
-rw-r--r--std/math/tanh.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/std/math/tanh.zig b/std/math/tanh.zig
index d9704f458a..c4fe8f2031 100644
--- a/std/math/tanh.zig
+++ b/std/math/tanh.zig
@@ -11,11 +11,11 @@ const expo2 = @import("expo2.zig").expo2;
pub fn tanh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
- switch (T) {
+ return switch (T) {
f32 => @inlineCall(tanh32, x),
f64 => @inlineCall(tanh64, x),
else => @compileError("tanh not implemented for " ++ @typeName(T)),
- }
+ };
}
// tanh(x) = (exp(x) - exp(-x)) / (exp(x) + exp(-x))
@@ -59,9 +59,9 @@ fn tanh32(x: f32) -> f32 {
}
if (u >> 31 != 0) {
- -t
+ return -t;
} else {
- t
+ return t;
}
}
@@ -104,9 +104,9 @@ fn tanh64(x: f64) -> f64 {
}
if (u >> 63 != 0) {
- -t
+ return -t;
} else {
- t
+ return t;
}
}