Truncate fractions in rounding::equivalent_fraction

This commit is contained in:
bakk 2022-01-23 02:50:14 +01:00 committed by PaddiM8
parent 66aeff3ade
commit 1b35a2ab42

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;
}