aboutsummaryrefslogtreecommitdiff
path: root/std/math/asin.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/asin.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/asin.zig')
-rw-r--r--std/math/asin.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/std/math/asin.zig b/std/math/asin.zig
index b0368b5d66..11aad04107 100644
--- a/std/math/asin.zig
+++ b/std/math/asin.zig
@@ -8,11 +8,11 @@ const assert = @import("../debug.zig").assert;
pub fn asin(x: var) -> @typeOf(x) {
const T = @typeOf(x);
- switch (T) {
+ return switch (T) {
f32 => @inlineCall(asin32, x),
f64 => @inlineCall(asin64, x),
else => @compileError("asin not implemented for " ++ @typeName(T)),
- }
+ };
}
fn r32(z: f32) -> f32 {
@@ -23,7 +23,7 @@ fn r32(z: f32) -> f32 {
const p = z * (pS0 + z * (pS1 + z * pS2));
const q = 1.0 + z * qS1;
- p / q
+ return p / q;
}
fn asin32(x: f32) -> f32 {
@@ -58,9 +58,9 @@ fn asin32(x: f32) -> f32 {
const fx = pio2 - 2 * (s + s * r32(z));
if (hx >> 31 != 0) {
- -fx
+ return -fx;
} else {
- fx
+ return fx;
}
}
@@ -78,7 +78,7 @@ fn r64(z: f64) -> f64 {
const p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5)))));
const q = 1.0 + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));
- p / q
+ return p / q;
}
fn asin64(x: f64) -> f64 {
@@ -119,7 +119,7 @@ fn asin64(x: f64) -> f64 {
// |x| > 0.975
if (ix >= 0x3FEF3333) {
- fx = pio2_hi - 2 * (s + s * r)
+ fx = pio2_hi - 2 * (s + s * r);
} else {
const jx = @bitCast(u64, s);
const df = @bitCast(f64, jx & 0xFFFFFFFF00000000);
@@ -128,9 +128,9 @@ fn asin64(x: f64) -> f64 {
}
if (hx >> 31 != 0) {
- -fx
+ return -fx;
} else {
- fx
+ return fx;
}
}