aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math/atan.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/atan.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/atan.zig')
-rw-r--r--lib/std/math/atan.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/std/math/atan.zig b/lib/std/math/atan.zig
index 41caae11a6..75be6ea746 100644
--- a/lib/std/math/atan.zig
+++ b/lib/std/math/atan.zig
@@ -46,7 +46,7 @@ fn atan32(x_: f32) f32 {
};
var x = x_;
- var ix: u32 = @bitCast(u32, x);
+ var ix: u32 = @as(u32, @bitCast(x));
const sign = ix >> 31;
ix &= 0x7FFFFFFF;
@@ -143,8 +143,8 @@ fn atan64(x_: f64) f64 {
};
var x = x_;
- var ux = @bitCast(u64, x);
- var ix = @intCast(u32, ux >> 32);
+ var ux = @as(u64, @bitCast(x));
+ var ix = @as(u32, @intCast(ux >> 32));
const sign = ix >> 31;
ix &= 0x7FFFFFFF;
@@ -165,7 +165,7 @@ fn atan64(x_: f64) f64 {
// |x| < 2^(-27)
if (ix < 0x3E400000) {
if (ix < 0x00100000) {
- math.doNotOptimizeAway(@floatCast(f32, x));
+ math.doNotOptimizeAway(@as(f32, @floatCast(x)));
}
return x;
}
@@ -212,7 +212,7 @@ fn atan64(x_: f64) f64 {
}
test "math.atan" {
- try expect(@bitCast(u32, atan(@as(f32, 0.2))) == @bitCast(u32, atan32(0.2)));
+ try expect(@as(u32, @bitCast(atan(@as(f32, 0.2)))) == @as(u32, @bitCast(atan32(0.2))));
try expect(atan(@as(f64, 0.2)) == atan64(0.2));
}