From e949ab9c6c73ee7d0aba64854d2d406ba2090e5c Mon Sep 17 00:00:00 2001 From: Mark Barbone Date: Wed, 1 Aug 2018 12:59:20 -0400 Subject: [PATCH] Modify atan2 to use `wrapping_` ops --- src/math/atan2.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/math/atan2.rs b/src/math/atan2.rs index a702ec3..37dad35 100644 --- a/src/math/atan2.rs +++ b/src/math/atan2.rs @@ -92,12 +92,12 @@ pub fn atan2(y: f64, x: f64) -> f64 { } } /* |y/x| > 0x1p64 */ - if ix + (64 << 20) < iy || iy == 0x7ff00000 { + if ix.wrapping_add(64 << 20) < iy || iy == 0x7ff00000 { return if m & 1 != 0 { -PI / 2.0 } else { PI / 2.0 }; } /* z = atan(|y/x|) without spurious underflow */ - let z = if (m & 2 != 0) && iy + (64 << 20) < ix { + let z = if (m & 2 != 0) && iy.wrapping_add(64 << 20) < ix { /* |y/x| < 0x1p-64, x<0 */ 0.0 } else {