aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math/acos.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-06-24 16:58:19 -0700
committerGitHub <noreply@github.com>2023-06-24 16:58:19 -0700
commit146b79af153bbd5dafda0ba12a040385c7fc58f8 (patch)
tree67e3db8b444d65c667e314770fc983a7fc8ba293 /lib/std/math/acos.zig
parent13853bef0df3c90633021850cc6d6abaeea03282 (diff)
parent21ac0beb436f49fe49c6982a872f2dc48e4bea5e (diff)
downloadzig-146b79af153bbd5dafda0ba12a040385c7fc58f8.tar.gz
zig-146b79af153bbd5dafda0ba12a040385c7fc58f8.zip
Merge pull request #16163 from mlugg/feat/builtins-infer-dest-ty
Infer destination type of cast builtins using result type
Diffstat (limited to 'lib/std/math/acos.zig')
-rw-r--r--lib/std/math/acos.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/std/math/acos.zig b/lib/std/math/acos.zig
index e88bed7227..1a29ca7b54 100644
--- a/lib/std/math/acos.zig
+++ b/lib/std/math/acos.zig
@@ -36,7 +36,7 @@ fn acos32(x: f32) f32 {
const pio2_hi = 1.5707962513e+00;
const pio2_lo = 7.5497894159e-08;
- const hx: u32 = @bitCast(u32, x);
+ const hx: u32 = @as(u32, @bitCast(x));
const ix: u32 = hx & 0x7FFFFFFF;
// |x| >= 1 or nan
@@ -72,8 +72,8 @@ fn acos32(x: f32) f32 {
// x > 0.5
const z = (1.0 - x) * 0.5;
const s = @sqrt(z);
- const jx = @bitCast(u32, s);
- const df = @bitCast(f32, jx & 0xFFFFF000);
+ const jx = @as(u32, @bitCast(s));
+ const df = @as(f32, @bitCast(jx & 0xFFFFF000));
const c = (z - df * df) / (s + df);
const w = r32(z) * s + c;
return 2 * (df + w);
@@ -100,13 +100,13 @@ fn acos64(x: f64) f64 {
const pio2_hi: f64 = 1.57079632679489655800e+00;
const pio2_lo: f64 = 6.12323399573676603587e-17;
- const ux = @bitCast(u64, x);
- const hx = @intCast(u32, ux >> 32);
+ const ux = @as(u64, @bitCast(x));
+ const hx = @as(u32, @intCast(ux >> 32));
const ix = hx & 0x7FFFFFFF;
// |x| >= 1 or nan
if (ix >= 0x3FF00000) {
- const lx = @intCast(u32, ux & 0xFFFFFFFF);
+ const lx = @as(u32, @intCast(ux & 0xFFFFFFFF));
// acos(1) = 0, acos(-1) = pi
if ((ix - 0x3FF00000) | lx == 0) {
@@ -141,8 +141,8 @@ fn acos64(x: f64) f64 {
// x > 0.5
const z = (1.0 - x) * 0.5;
const s = @sqrt(z);
- const jx = @bitCast(u64, s);
- const df = @bitCast(f64, jx & 0xFFFFFFFF00000000);
+ const jx = @as(u64, @bitCast(s));
+ const df = @as(f64, @bitCast(jx & 0xFFFFFFFF00000000));
const c = (z - df * df) / (s + df);
const w = r64(z) * s + c;
return 2 * (df + w);