aboutsummaryrefslogtreecommitdiff
path: root/std/math/hypot.zig
diff options
context:
space:
mode:
authorAndrea Orru <andrea@orru.io>2018-08-06 01:43:19 -0400
committerAndrea Orru <andrea@orru.io>2018-08-06 01:43:19 -0400
commitd2f5e57b68da0b16e5789ca19045ccbcb4ecfa8d (patch)
treee9fa3caec533a0d1e2b434868b2fde1f9240e5c8 /std/math/hypot.zig
parent06614b3fa09954464c2e2f32756cacedc178a282 (diff)
parent63a23e848a62d5f167f8d5478de9766cb24aa6eb (diff)
downloadzig-d2f5e57b68da0b16e5789ca19045ccbcb4ecfa8d.tar.gz
zig-d2f5e57b68da0b16e5789ca19045ccbcb4ecfa8d.zip
Merge branch 'master' into zen_stdlib
Diffstat (limited to 'std/math/hypot.zig')
-rw-r--r--std/math/hypot.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/std/math/hypot.zig b/std/math/hypot.zig
index 06427d0865..f834f422e6 100644
--- a/std/math/hypot.zig
+++ b/std/math/hypot.zig
@@ -39,26 +39,26 @@ fn hypot32(x: f32, y: f32) f32 {
}
var z: f32 = 1.0;
- if (ux >= (0x7F+60) << 23) {
+ if (ux >= (0x7F + 60) << 23) {
z = 0x1.0p90;
xx *= 0x1.0p-90;
yy *= 0x1.0p-90;
- } else if (uy < (0x7F-60) << 23) {
+ } else if (uy < (0x7F - 60) << 23) {
z = 0x1.0p-90;
xx *= 0x1.0p-90;
yy *= 0x1.0p-90;
}
- return z * math.sqrt(f32(f64(x) * x + f64(y) * y));
+ return z * math.sqrt(@floatCast(f32, f64(x) * x + f64(y) * y));
}
-fn sq(hi: &f64, lo: &f64, x: f64) void {
+fn sq(hi: *f64, lo: *f64, x: f64) void {
const split: f64 = 0x1.0p27 + 1.0;
const xc = x * split;
const xh = x - xc + xc;
const xl = x - xh;
- *hi = x * x;
- *lo = xh * xh - *hi + 2 * xh * xl + xl * xl;
+ hi.* = x * x;
+ lo.* = xh * xh - hi.* + 2 * xh * xl + xl * xl;
}
fn hypot64(x: f64, y: f64) f64 {