File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -54,11 +54,10 @@ macro_rules! impl_mul_fraction {
5454 self ,
5555 rhs: F ,
5656 ) -> Result <Self , CheckedMultiplyFractionError > {
57- let divisor = rhs. denominator( ) . into( ) ;
58- let remainder = self
59- . full_mul( rhs. numerator( ) . into( ) )
60- . checked_rem( divisor. into( ) ) ?;
61- let floor_result = self . checked_mul_floor( rhs) ?;
57+ let dividend = self . full_mul( rhs. numerator( ) . into( ) ) ;
58+ let divisor = rhs. denominator( ) . into( ) . into( ) ;
59+ let floor_result = dividend. checked_div( divisor) ?. try_into( ) ?;
60+ let remainder = dividend. checked_rem( divisor) ?;
6261 if !remainder. is_zero( ) {
6362 Ok ( $Uint:: one( ) . checked_add( floor_result) ?)
6463 } else {
@@ -105,11 +104,10 @@ macro_rules! impl_mul_fraction {
105104 where
106105 Self : Sized ,
107106 {
108- let divisor = rhs. numerator( ) . into( ) ;
109- let remainder = self
110- . full_mul( rhs. denominator( ) . into( ) )
111- . checked_rem( divisor. into( ) ) ?;
112- let floor_result = self . checked_div_floor( rhs) ?;
107+ let dividend = self . full_mul( rhs. denominator( ) . into( ) ) ;
108+ let divisor = rhs. numerator( ) . into( ) . into( ) ;
109+ let floor_result = dividend. checked_div( divisor) ?. try_into( ) ?;
110+ let remainder = dividend. checked_rem( divisor) ?;
113111 if !remainder. is_zero( ) {
114112 Ok ( $Uint:: one( ) . checked_add( floor_result) ?)
115113 } else {
You can’t perform that action at this time.
0 commit comments