hasFinitePrecision property
bool
get
hasFinitePrecision
Checks if the fraction can be translated exactly to a floating point number.
Implementation
bool get hasFinitePrecision {
// the denominator should only be a product of powers of 2 and 5
var den = denominator;
while (den % BigInt.from(5) == BigInt.zero) {
den = den ~/ BigInt.from(5);
}
while (den % BigInt.two == BigInt.zero) {
den = den ~/ BigInt.two;
}
return den == BigInt.one;
}