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/atan.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/atan.zig')
| -rw-r--r-- | std/math/atan.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/std/math/atan.zig b/std/math/atan.zig index 5f3e207960..4527f6bf28 100644 --- a/std/math/atan.zig +++ b/std/math/atan.zig @@ -8,11 +8,11 @@ const assert = @import("../debug.zig").assert; pub fn atan(x: var) -> @typeOf(x) { const T = @typeOf(x); - switch (T) { + return switch (T) { f32 => @inlineCall(atan32, x), f64 => @inlineCall(atan64, x), else => @compileError("atan not implemented for " ++ @typeName(T)), - } + }; } fn atan32(x_: f32) -> f32 { @@ -100,10 +100,10 @@ fn atan32(x_: f32) -> f32 { const s2 = w * (aT[1] + w * aT[3]); if (id == null) { - x - x * (s1 + s2) + return x - x * (s1 + s2); } else { const zz = atanhi[??id] - ((x * (s1 + s2) - atanlo[??id]) - x); - if (sign != 0) -zz else zz + return if (sign != 0) -zz else zz; } } @@ -199,10 +199,10 @@ fn atan64(x_: f64) -> f64 { const s2 = w * (aT[1] + w * (aT[3] + w * (aT[5] + w * (aT[7] + w * aT[9])))); if (id == null) { - x - x * (s1 + s2) + return x - x * (s1 + s2); } else { const zz = atanhi[??id] - ((x * (s1 + s2) - atanlo[??id]) - x); - if (sign != 0) -zz else zz + return if (sign != 0) -zz else zz; } } |
