aboutsummaryrefslogtreecommitdiff
path: root/std/math/atanh.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-01-25 04:10:11 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-01-25 04:10:11 -0500
commit3671582c15235e5f79a84936ea2f834f6968ff8c (patch)
tree7fa2c7f06331feaad43ba63b0969add120633d49 /std/math/atanh.zig
parente5bc5873d74713bedbc32817ed31370c3256418d (diff)
downloadzig-3671582c15235e5f79a84936ea2f834f6968ff8c.tar.gz
zig-3671582c15235e5f79a84936ea2f834f6968ff8c.zip
syntax: functions require return type. remove `->`
The purpose of this is: * Only one way to do things * Changing a function with void return type to return a possible error becomes a 1 character change, subtly encouraging people to use errors. See #632 Here are some imperfect sed commands for performing this update: remove arrow: ``` sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig") ``` add void: ``` sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig") ``` Some cleanup may be necessary, but this should do the bulk of the work.
Diffstat (limited to 'std/math/atanh.zig')
-rw-r--r--std/math/atanh.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/std/math/atanh.zig b/std/math/atanh.zig
index e787506765..8ca0cc85bc 100644
--- a/std/math/atanh.zig
+++ b/std/math/atanh.zig
@@ -8,7 +8,7 @@ const std = @import("../index.zig");
const math = std.math;
const assert = std.debug.assert;
-pub fn atanh(x: var) -> @typeOf(x) {
+pub fn atanh(x: var) @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
f32 => atanh_32(x),
@@ -18,7 +18,7 @@ pub fn atanh(x: var) -> @typeOf(x) {
}
// atanh(x) = log((1 + x) / (1 - x)) / 2 = log1p(2x / (1 - x)) / 2 ~= x + x^3 / 3 + o(x^5)
-fn atanh_32(x: f32) -> f32 {
+fn atanh_32(x: f32) f32 {
const u = @bitCast(u32, x);
const i = u & 0x7FFFFFFF;
const s = u >> 31;
@@ -47,7 +47,7 @@ fn atanh_32(x: f32) -> f32 {
return if (s != 0) -y else y;
}
-fn atanh_64(x: f64) -> f64 {
+fn atanh_64(x: f64) f64 {
const u = @bitCast(u64, x);
const e = (u >> 52) & 0x7FF;
const s = u >> 63;