Rational

A rational number, always in reduced form. Supports basic arithmetic.

Constructors

this
this(long n)

Construct a Rational from an integer.

this
this(Rational f)

Construct a Rational from another Rational.

this
this(long numerator, long denominator)

Construct a Rational from numerator and denominator.

Members

Functions

inverse
Rational inverse()
opAssign
Rational opAssign(T other)

Assign with another Rational.

opAssign
Rational opAssign(T n)

Assign with an integer.

opBinary
Rational opBinary(T o)
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
T opCast()

Cast to floating point.

opCmp
int opCmp(T o)
Undocumented in source. Be warned that the author may not have intended to support it.
opCmp
int opCmp(T o)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(T y)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(T o)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Rational opOpAssign(T o)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Rational opOpAssign(T o)
Undocumented in source. Be warned that the author may not have intended to support it.
opUnary
Rational opUnary()
Undocumented in source. Be warned that the author may not have intended to support it.
opUnary
Rational opUnary()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()

Converts to pretty string.

Variables

denom
long denom;

Denominator.

num
long num;

Numerator.

Bugs

Remove this module once std.rational is here.

Meta