Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit f4ca302

Browse files
authored
bump malachite to 0.4.4 (#3)
1 parent c80ff70 commit f4ca302

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22
name = "malachite-bigint"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Steve Shi <[email protected]>"]
55
edition = "2021"
66
license = "LGPL-3.0-only"
77
description = "A drop-in num-bigint replacement based on malachite"
88

99
[dependencies]
10-
malachite = "0.3.2"
10+
malachite = "0.4.4"
1111
num-traits = { version = "0.2.11", default-features = false, features = ["i128"] }
1212
num-integer = { version = "0.1.45", default-features = false, features = ["i128"] }
1313
derive_more = "0.99.17"

src/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl Num for BigInt {
280280
impl 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]

src/biguint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl Num for BigUint {
245245
impl 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]

src/macros.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)