klyn.math.Rational.simplify
method
public simplify() as Void
Description

Reduces the fraction and makes its denominator positive. Intermediate magnitudes use Long so Int.MIN_VALUE remains exact. The instance is unchanged if its normalized components cannot fit Int.

Throws
  • ValueException when a normalized component is outside Int's range.
Example
value = Rational(Int.MIN_VALUE, -2)
value.simplify()
assert value.numerator == 1_073_741_824
assert value.denominator == 1