public class Rational extends Object
Represents a rational number with a numerator and a denominator.
| Modifier and Type | Member | Description |
|---|---|---|
| public property | denominatordenominator as Int |
Property for the denominator. |
| public property | numeratornumerator as Int |
Property for the numerator. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | RationalRational( num as Int = 0, den as Int = 1 ) throws ZeroDivisionException |
Constructor for Rational class. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | hashhash() as Long |
Returns a value hash compatible with rational equality. |
| public | simplifysimplify() as Void |
Reduces the fraction and makes its denominator positive. |
| public override | toStringtoString() as String |
Returns the string representation of the rational number. |