aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math/complex/tanh.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/complex/tanh.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/complex/tanh.zig')
-rw-r--r--lib/std/math/complex/tanh.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/math/complex/tanh.zig b/lib/std/math/complex/tanh.zig
index 92e197e308..a90f141741 100644
--- a/lib/std/math/complex/tanh.zig
+++ b/lib/std/math/complex/tanh.zig
@@ -24,7 +24,7 @@ fn tanh32(z: Complex(f32)) Complex(f32) {
const x = z.re;
const y = z.im;
- const hx = @bitCast(u32, x);
+ const hx = @as(u32, @bitCast(x));
const ix = hx & 0x7fffffff;
if (ix >= 0x7f800000) {
@@ -32,7 +32,7 @@ fn tanh32(z: Complex(f32)) Complex(f32) {
const r = if (y == 0) y else x * y;
return Complex(f32).init(x, r);
}
- const xx = @bitCast(f32, hx - 0x40000000);
+ const xx = @as(f32, @bitCast(hx - 0x40000000));
const r = if (math.isInf(y)) y else @sin(y) * @cos(y);
return Complex(f32).init(xx, math.copysign(@as(f32, 0.0), r));
}
@@ -62,11 +62,11 @@ fn tanh64(z: Complex(f64)) Complex(f64) {
const x = z.re;
const y = z.im;
- const fx = @bitCast(u64, x);
+ const fx = @as(u64, @bitCast(x));
// TODO: zig should allow this conversion implicitly because it can notice that the value necessarily
// fits in range.
- const hx = @intCast(u32, fx >> 32);
- const lx = @truncate(u32, fx);
+ const hx = @as(u32, @intCast(fx >> 32));
+ const lx = @as(u32, @truncate(fx));
const ix = hx & 0x7fffffff;
if (ix >= 0x7ff00000) {
@@ -75,7 +75,7 @@ fn tanh64(z: Complex(f64)) Complex(f64) {
return Complex(f64).init(x, r);
}
- const xx = @bitCast(f64, (@as(u64, hx - 0x40000000) << 32) | lx);
+ const xx = @as(f64, @bitCast((@as(u64, hx - 0x40000000) << 32) | lx));
const r = if (math.isInf(y)) y else @sin(y) * @cos(y);
return Complex(f64).init(xx, math.copysign(@as(f64, 0.0), r));
}