operator / method

Decimal operator /(
  1. Decimal other
)

Division, may return Rational if not exact decimal
Examples:

  • Decimal.parse("10") / Decimal.parse("4") -> "2.5"
  • Decimal.parse("1") / Decimal.parse("3") -> "1/3" (Rational representation)
  • Decimal.parse("2") / Decimal.parse("6") -> "1/3" (Rational representation)
  • Decimal.parse("1") / Decimal.parse("8") -> "0.125"
  • Decimal.parse("1") / Decimal.parse("0") -> throws ArgumentError

Implementation

Decimal operator /(Decimal other) {
  return this.divide(other);
}