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 {
54
54
self ,
55
55
rhs: F ,
56
56
) -> 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) ?;
62
61
if !remainder. is_zero( ) {
63
62
Ok ( $Uint:: one( ) . checked_add( floor_result) ?)
64
63
} else {
@@ -105,11 +104,10 @@ macro_rules! impl_mul_fraction {
105
104
where
106
105
Self : Sized ,
107
106
{
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) ?;
113
111
if !remainder. is_zero( ) {
114
112
Ok ( $Uint:: one( ) . checked_add( floor_result) ?)
115
113
} else {
You can’t perform that action at this time.
0 commit comments