pow method

Rational pow(
  1. int exponent
)

Returns this to the power of exponent.

Returns one if the exponent equals 0.

Implementation

Rational pow(int exponent) => exponent.isNegative
    ? inverse.pow(-exponent)
    : Rational(
        numerator.pow(exponent),
        denominator.pow(exponent),
      );