Implicit class RationalOps to allow an Int to be treated as a Rational for the purpose of allowing operations with right-hand Rational arguments or for division by an Int. A particular case is rational division where we must convert the numerator to Rational so that we don't end up with 0 as the result of an Int division.
Method to divide by Rational. We cannot just use "/" as that will bind to Int and result in 0. Therefore, we use the special ":/" operator which will work as long as RationalOps is imported.
Method to divide by Rational. We cannot just use "/" as that will bind to Int and result in 0. Therefore, we use the special ":/" operator which will work as long as RationalOps is imported.
Value parameters
denominator
the denominator of the resulting Rational. Any Int will be implicitly converted to a Long.
Computes the multiplicative inverse of the Rational representation of the given integer. The result is equivalent to 1 divided by the Rational value of the integer.
Computes the multiplicative inverse of the Rational representation of the given integer. The result is equivalent to 1 divided by the Rational value of the integer.
Attributes
Returns
the inverted Rational representation of the integer.