hasFinitePrecision property

bool get hasFinitePrecision

Returns true if this Rational has a finite precision.

Having a finite precision means that the number can be exactly represented as decimal with a finite number of fractional digits.

Implementation

bool get hasFinitePrecision {
  // the denominator should only be a product of powers of 2 and 5
  var den = denominator;
  while (den % _i5 == _i0) {
    den = den ~/ _i5;
  }
  while (den % _i2 == _i0) {
    den = den ~/ _i2;
  }
  return den == _i1;
}