toCents method

Rational toCents([
  1. RoundingMode mode = RoundingMode.halfUp
])

Rounds the rational number to the nearest cent (two decimal places)

Parameters:

Returns: The rational number rounded to the nearest cent

Implementation

Rational toCents([RoundingMode mode = RoundingMode.halfUp]) {
  return toNearestDecimal(2, mode: mode);
}