From 1790390055790af0127258e060fd08036df04e4f Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 2 Dec 2023 01:31:42 -0800 Subject: [PATCH] don't mess with casts, wtf --- src/integer.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/integer.rs b/src/integer.rs index 4239dcf..350454e 100644 --- a/src/integer.rs +++ b/src/integer.rs @@ -105,23 +105,23 @@ impl Ratio64{ None }else{ let d=gcd(num.unsigned_abs(),den); - Some(Self{num:num/d as i64,den:den/d}) + Some(Self{num:num/(d as i64),den:den/d}) } } #[inline] pub fn mul_int(&self,rhs:i64)->i64{ - rhs*self.num/self.den as i64 + rhs*self.num/(self.den as i64) } #[inline] pub fn rhs_div_int(&self,rhs:i64)->i64{ - rhs*self.den as i64/self.num + rhs*(self.den as i64)/self.num } #[inline] pub fn mul_ref(&self,rhs:&Ratio64)->Ratio64{ let (num,den)=(self.num*rhs.num,self.den*rhs.den); let d=gcd(num.unsigned_abs(),den); Self{ - num:num/d as i64, + num:num/(d as i64), den:den/d, } } @@ -234,7 +234,7 @@ impl std::ops::Mul for Ratio64{ let (num,den)=(self.num*rhs.num,self.den*rhs.den); let d=gcd(num.unsigned_abs(),den); Self{ - num:num/d as i64, + num:num/(d as i64), den:den/d, } } @@ -451,7 +451,7 @@ impl Into for Planar64{ impl From for Planar64{ #[inline] fn from(ratio:Ratio64)->Self{ - Self((((ratio.num as i128)<<32)/ratio.den as i128) as i64) + Self((((ratio.num as i128)<<32)/(ratio.den as i128)) as i64) } } #[derive(Debug)] @@ -572,7 +572,7 @@ impl std::ops::Div for Planar64{ type Output=Planar64; #[inline] fn div(self, rhs: Planar64) -> Self::Output { - Planar64((((self.0 as i128)<<32)/rhs.0 as i128) as i64) + Planar64((((self.0 as i128)<<32)/(rhs.0 as i128)) as i64) } } // impl PartialOrd for Planar64{