Rational

sealed abstract
class Rational extends ScalaNumber with ScalaNumericConversions with Ordered[Rational]
Companion
object
trait Ordered[Rational]
trait Comparable[Rational]
trait ScalaNumericConversions
trait ScalaNumericAnyConversions
class ScalaNumber
class Number
trait Serializable
class Object
trait Matchable
class Any

Value members

Abstract methods

def *(rhs: Rational): Rational
def +(rhs: Rational): Rational
def -(rhs: Rational): Rational
def /(rhs: Rational): Rational
def compareToOne: Int
def isOne: Boolean
def isValidLong: Boolean
def isWhole: Boolean
def isZero: Boolean
def numeratorAsLong: Long
def pow(exp: Int): Rational
def signum: Int

Concrete methods

def %(rhs: Rational): Rational
override
def byteValue: Byte
Definition Classes
ScalaNumericAnyConversions -> Number
override
def equals(that: Any): Boolean
Definition Classes
Any
def floatValue: Float
def gcd(rhs: Rational): Rational
def intValue: Int
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 Params
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 longValue: Long
def max(rhs: Rational): Rational
def min(rhs: Rational): Rational
override
def shortValue: Short
Definition Classes
ScalaNumericAnyConversions -> Number
def sign: Sign
def toBigDecimal(scale: Int, mode: RoundingMode): BigDecimal
def toBigDecimal(mc: MathContext): BigDecimal
final
def toBigInt: BigInt
override
def underlying: Object
Definition Classes
ScalaNumericConversions -> ScalaNumber

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
def doubleValue: Double
Inherited from
ScalaNumericAnyConversions
def isValidByte: Boolean
Inherited from
ScalaNumericAnyConversions
def isValidChar: Boolean
Inherited from
ScalaNumericAnyConversions
def isValidInt: Boolean
Inherited from
ScalaNumericAnyConversions
def isValidShort: Boolean
Inherited from
ScalaNumericAnyConversions
def toByte: Byte
Inherited from
ScalaNumericAnyConversions
def toChar: Char
Inherited from
ScalaNumericAnyConversions
def toDouble: Double
Inherited from
ScalaNumericAnyConversions
def toFloat: Float
Inherited from
ScalaNumericAnyConversions
def toInt: Int
Inherited from
ScalaNumericAnyConversions
def toLong: Long
Inherited from
ScalaNumericAnyConversions
def toShort: Short
Inherited from
ScalaNumericAnyConversions
protected
def unifiedPrimitiveEquals(x: Any): Boolean
Inherited from
ScalaNumericAnyConversions
protected
Inherited from
ScalaNumericAnyConversions