Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit c7aa961

Browse files
committed
Modify atan2 to use wrapping_ ops
1 parent 8e857c7 commit c7aa961

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/math/atan2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ pub fn atan2(y: f64, x: f64) -> f64 {
9191
}
9292
}
9393
/* |y/x| > 0x1p64 */
94-
if ix + (64 << 20) < iy || iy == 0x7ff00000 {
94+
if ix.wrapping_add(64 << 20) < iy || iy == 0x7ff00000 {
9595
return if m & 1 != 0 { -PI / 2.0 } else { PI / 2.0 };
9696
}
9797

9898
/* z = atan(|y/x|) without spurious underflow */
99-
let z = if (m & 2 != 0) && iy + (64 << 20) < ix {
99+
let z = if (m & 2 != 0) && iy.wrapping_add(64 << 20) < ix {
100100
/* |y/x| < 0x1p-64, x<0 */
101101
0.0
102102
} else {

0 commit comments

Comments
 (0)