precision property

int get precision

The precision of this num.

The sum of the number of digits before and after the decimal point.

WARNING for dart2js : It can give bad result for large number.

Throws StateError if the precision is infinite, i.e. when hasFinitePrecision is false.

Implementation

int get precision {
  if (!hasFinitePrecision) {
    throw StateError('This number has an infinite precision: $this');
  }
  var x = numerator;
  while (x % denominator != _i0) {
    x *= _i10;
  }
  x = x ~/ denominator;
  return x.abs().toString().length;
}