coerce rationals to floats before coercing floats to rationals.
This commit is contained in:
@@ -484,7 +484,10 @@ impl NumberPair {
|
||||
}
|
||||
|
||||
fn float_rational_pair(n1: OrderedFloat<f64>, n2: Ratio<BigInt>) -> NumberPair {
|
||||
if let Some(r) = Ratio::from_float(n1.into_inner()) {
|
||||
match (n2.numer().to_f64(), n2.denom().to_f64()) {
|
||||
(Some(num), Some(denom)) =>
|
||||
NumberPair::Float(n1, OrderedFloat(num / denom)),
|
||||
_ => if let Some(r) = Ratio::from_float(n1.into_inner()) {
|
||||
NumberPair::Rational(r, n2)
|
||||
} else if n1.into_inner().is_sign_positive() {
|
||||
NumberPair::Float(OrderedFloat(f64::infinity()),
|
||||
@@ -494,6 +497,7 @@ impl NumberPair {
|
||||
OrderedFloat(f64::neg_infinity()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn from(n1: Number, n2: Number) -> NumberPair
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user