Truncate fractions in rounding::equivalent_fraction

This commit is contained in:
bakk 2022-01-23 02:50:14 +01:00
parent 5c0b7e118b
commit 3f4cfd9359

View File

@ -153,6 +153,9 @@ fn equivalent_fraction(value: f64) -> Option<String> {
numer /= gcd;
denom /= gcd;
numer = numer.trunc();
denom = denom.trunc();
if denom <= 1f64 || denom >= 100f64 || denom == 10f64 {
return None;
}