decimalPartAsDouble property

double get decimalPartAsDouble

Returns the decimal part of this number as double.

See decimalPartAsString.

Implementation

double get decimalPartAsDouble {
  if (precision == 0) return 0.0;
  var multiplier = _scale;

  var n = _wholePartMultiplied(multiplier);
  var d = _n.subtractDynamicInt(n).abs();
  var dec = d.divideDynamicIntAsDouble(multiplier);

  if (isNegative && !dec.isNegative) {
    dec = -dec;
  }

  return dec;
}