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/cbrt.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/cbrt.zig')
| -rw-r--r-- | std/math/cbrt.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/std/math/cbrt.zig b/std/math/cbrt.zig index 273939c6b6..ff353655b5 100644 --- a/std/math/cbrt.zig +++ b/std/math/cbrt.zig @@ -9,11 +9,11 @@ const assert = @import("../debug.zig").assert; pub fn cbrt(x: var) -> @typeOf(x) { const T = @typeOf(x); - switch (T) { + return switch (T) { f32 => @inlineCall(cbrt32, x), f64 => @inlineCall(cbrt64, x), else => @compileError("cbrt not implemented for " ++ @typeName(T)), - } + }; } fn cbrt32(x: f32) -> f32 { @@ -53,7 +53,7 @@ fn cbrt32(x: f32) -> f32 { r = t * t * t; t = t * (f64(x) + x + r) / (x + r + r); - f32(t) + return f32(t); } fn cbrt64(x: f64) -> f64 { @@ -109,7 +109,7 @@ fn cbrt64(x: f64) -> f64 { var w = t + t; q = (q - t) / (w + q); - t + t * q + return t + t * q; } test "math.cbrt" { |
