8000 bump malachite to 0.4.4 (#5069) · RustPython/RustPython@b8f22e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit b8f22e2

Browse files
authored
bump malachite to 0.4.4 (#5069)
1 parent b4b71e5 commit b8f22e2

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ rustpython-pylib = { path = "pylib", version = "0.3.0" }
2929
rustpython-stdlib = { path = "stdlib", default-features = false, version = "0.3.0" }
3030
rustpython-doc = { git = "https://github.com/RustPython/__doc__", tag = "0.3.0 8000 ", version = "0.3.0" }
3131

32-
rustpython-literal = { git = "https://github.com/RustPython/Parser.git", rev = "13cae0af64d0a23de95f08c0210e97ad74d155e9" }
33-
rustpython-parser-core = { git = "https://github.com/RustPython/Parser.git", rev = "13cae0af64d0a23de95f08c0210e97ad74d155e9" }
34-
rustpython-parser = { git = "https://github.com/RustPython/Parser.git", rev = "13cae0af64d0a23de95f08c0210e97ad74d155e9" }
35-
rustpython-ast = { git = "https://github.com/RustPython/Parser.git", rev = "13cae0af64d0a23de95f08c0210e97ad74d155e9" }
36-
rustpython-format = { git = "https://github.com/RustPython/Parser.git", rev = "13cae0af64d0a23de95f08c0210e97ad74d155e9" }
32+
rustpython-literal = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
33+
rustpython-parser-core = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
34+
rustpython-parser = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
35+
rustpython-ast = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
36+
rustpython-format = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
3737
# rustpython-literal = { path = "../RustPython-parser/literal" }
3838
# rustpython-parser-core = { path = "../RustPython-parser/core" }
3939
# rustpython-parser = { path = "../RustPython-parser/parser" }
@@ -59,9 +59,9 @@ is-macro = "0.3.0"
5959
libc = "0.2.133"
6060
log = "0.4.16"
6161
nix = "0.26"
62-
malachite-bigint = { version = "0.1.0" }
63-
malachite-q = "0.3.2"
64-
malachite-base = "0.3.2"
62+
malachite-bigint = "0.1.1"
63+
malachite-q = "0.4.4"
64+
malachite-base = "0.4.4"
6565
num-complex = "0.4.0"
6666
num-integer = "0.1.44"
6767
num-traits = "0.2"

common/src/int.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use malachite_q::Rational;
55
use num_traits::{One, ToPrimitive, Zero};
66

77
pub fn true_div(numerator: &BigInt, denominator: &BigInt) -> f64 {
8-
let val: f64 = Rational::from_integers_ref(numerator.into(), denominator.into())
9-
.rounding_into(RoundingMode::Nearest);
10-
11-
if val == f64::MAX || val == f64::MIN {
12-
// FIXME: not possible for available ratio?
13-
return f64::INFINITY;
8+
let rational = Rational::from_integers_ref(numerator.into(), denominator.into());
9+
match rational.rounding_into(RoundingMode::Nearest) {
10+
// returned value is $t::MAX but still less than the original
11+
(val, std::cmp::Ordering::Less) if val == f64::MAX => f64::INFINITY,
12+
// returned value is $t::MIN but still greater than the original
13+
(val, std::cmp::Ordering::Greater) if val == f64::MIN => f64::NEG_INFINITY,
14+
(val, _) => val,
1415
}
15-
val
1616
}
1717

1818
pub fn float_to_ratio(value: f64) -> Option<(BigInt, BigInt)> {

0 commit comments

Comments
 (0)
0