This repository was archived by the owner on Feb 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " malachite-bigint"
3- version = " 0.1.0 "
3+ version = " 0.1.1 "
44authors = [
" Steve Shi <[email protected] >" ]
55edition = " 2021"
66license = " LGPL-3.0-only"
77description = " A drop-in num-bigint replacement based on malachite"
88
99[dependencies ]
10- malachite = " 0.3.2 "
10+ malachite = " 0.4.4 "
1111num-traits = { version = " 0.2.11" , default-features = false , features = [" i128" ] }
1212num-integer = { version = " 0.1.45" , default-features = false , features = [" i128" ] }
1313derive_more = " 0.99.17"
Original file line number Diff line number Diff line change @@ -280,7 +280,7 @@ impl Num for BigInt {
280280impl num_integer:: Integer for BigInt {
281281 #[ inline]
282282 fn div_floor ( & self , other : & Self ) -> Self {
283- ( & self . 0 ) . div_round ( & other. 0 , RoundingMode :: Floor ) . into ( )
283+ ( & self . 0 ) . div_round ( & other. 0 , RoundingMode :: Floor ) . 0 . into ( )
284284 }
285285
286286 #[ inline]
Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ impl Num for BigUint {
245245impl num_integer:: Integer for BigUint {
246246 #[ inline]
247247 fn div_floor ( & self , other : & Self ) -> Self {
248- ( & self . 0 ) . div_round ( & other. 0 , RoundingMode :: Floor ) . into ( )
248+ ( & self . 0 ) . div_round ( & other. 0 , RoundingMode :: Floor ) . 0 . into ( )
249249 }
250250
251251 #[ inline]
Original file line number Diff line number Diff line change @@ -397,7 +397,7 @@ macro_rules! impl_from_primitive_fn_float {
397397 if !n. is_finite( ) {
398398 return None ;
399399 }
400- Some ( Self ( n. rounding_into( RoundingMode :: Down ) ) )
400+ Some ( Self ( n. rounding_into( RoundingMode :: Down ) . 0 ) )
401401 }
402402 }
403403 } ;
@@ -432,11 +432,12 @@ macro_rules! impl_to_primitive_fn_float {
432432 paste! {
433433 #[ inline]
434434 fn [ <to_ $t>] ( & self ) -> Option <$t> {
435- let val: $t = ( & self . 0 ) . rounding_into( RoundingMode :: Nearest ) ;
436- if val == $t:: MAX || val == $t:: MIN {
437- ( self . 0 == val) . then_some( val)
438- } else {
439- Some ( val)
435+ match ( & self . 0 ) . rounding_into( RoundingMode :: Nearest ) {
436+ // returned value is $t::MAX but still less than the original
437+ ( val, std:: cmp:: Ordering :: Less ) if val == $t:: MAX => None ,
438+ // returned value is $t::MIN but still greater than the original
439+ ( val, std:: cmp:: Ordering :: Greater ) if val == $t:: MIN => None ,
440+ ( val, _) => Some ( val) ,
440441 }
441442 }
442443 }
You can’t perform that action at this time.
0 commit comments