Rational
class in package klyn.math

    public class Rational extends Object:

Object
└ Rational

Represents a rational number with a numerator and a denominator.

Properties

Modifier and Type | Member | Description
--- | --- | ---
public property | denominator `denominator as Int:` | Property for the denominator.
public property | numerator `numerator as Int:` | Property for the numerator.

Inherited Properties
property Inherited Properties from Object: type
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | Rational `Rational( num as Int = 0, den as Int = 1 ) throws ZeroDivisionException:` | Constructor for Rational class.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | simplify `simplify() as Void:` | Simplifies the rational number.
public override readonly | toString `toString() as String:` | Returns the string representation of the rational number.

Inherited Methods
method Inherited Methods from Object: deepCopy, fromJson, toDict, toJson, toString, toXml
Operators

Modifier and Type | Member | Description
--- | --- | ---
public static | operator!=(readonly notnull r1 as Rational, readonly notnull r2 as Rational) as Boolean: | Value inequality between two rational numbers.
public static | operator*( readonly notnull r1 as Rational, readonly notnull r2 as Rational ) as Rational: | Overloaded multiplication operator for Rational numbers.
public static | operator+(readonly notnull r1 as Rational, readonly notnull r2 as Rational) as Rational: | Overloaded addition operator for Rational numbers.
public static | operator-( readonly notnull r1 as Rational, readonly notnull r2 as Rational ) as Rational: | Overloaded subtraction operator for Rational numbers.
public static | operator/( readonly notnull r1 as Rational, readonly notnull r2 as Rational ) as Rational throws ZeroDivisionException: | Overloaded division operator for Rational numbers.
public static | operator==(readonly notnull r1 as Rational, readonly notnull r2 as Rational) as Boolean: | Value equality between two rational numbers.