Rational

sealed abstract class Rational extends ScalaNumber with ScalaNumericConversions with Ordered[Rational]
Companion:
object

Value members

Concrete methods

def %(rhs: Rational): Rational
override def byteValue: Byte
Definition Classes
override def equals(that: Any): Boolean
Definition Classes
Any
def gcd(rhs: Rational): Rational
def lcm(rhs: Rational): Rational

Finds the closest Rational to this Rational whose denominator is no larger than limit.

Finds the closest Rational to this Rational whose denominator is no larger than limit.

See http://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree#Mediants_and_binary_search

Returns a Rational whose denominator and numerator are no larger than max and whose value is close to the original. This applies, even if, for example, this Rational is greater than max. In that case, Rational(max, 1) is returned.

Returns a Rational whose denominator and numerator are no larger than max and whose value is close to the original. This applies, even if, for example, this Rational is greater than max. In that case, Rational(max, 1) is returned.

Value parameters:
max

A positive integer.

Returns a Rational whose numerator and denominator both fit in an Int.

Returns a Rational whose numerator and denominator both fit in an Int.

Returns a Rational whose numerator and denominator both fit in a Long.

Returns a Rational whose numerator and denominator both fit in a Long.

def max(rhs: Rational): Rational
def min(rhs: Rational): Rational
override def shortValue: Short
Definition Classes
def sign: Sign
final def toBigInt: BigInt
override def underlying: Object

Inherited methods

def <(that: Rational): Boolean
Inherited from:
Ordered
def <=(that: Rational): Boolean
Inherited from:
Ordered
def >(that: Rational): Boolean
Inherited from:
Ordered
def >=(that: Rational): Boolean
Inherited from:
Ordered
def compare(that: Rational): Int
Inherited from:
Ordered
def compareTo(that: Rational): Int
Inherited from:
Ordered
protected def unifiedPrimitiveEquals(x: Any): Boolean