MpQ

Arbitrary (multi) precision rational number (Q). Wrapper for GNU MP (GMP)'s type mpq_t and functions __gmpq_.*.

Constructors

this
this()

No default construction for now, because mpq_init initialize __mpq_struct-fields to non-zero values.

this
this(typeof(null) )

Construct empty (undefined) from explicit null.

this
this(P value)

Construct from floating-point value.

this
this(P pValue, Q qValue, bool canonicalizeFlag)

Construct from pValue / qValue.

Destructor

~this
~this()

Destruct this.

Postblit

this(this)
this(this)

No copy construction.

Members

Functions

absolute
void absolute()

Make this the absolute value of itself in-place.

canonicalize
void canonicalize()

Canonicalize this.

invert
void invert()

Invert this in-place.

opAssign
MpQ opAssign(P value)

Construct from floating-point value.

opAssign
MpQ opAssign(P value)

Assign from integer value.

opBinary
MpQ opBinary(MpQ rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
T opCast()
opCmp
int opCmp(MpQ rhs)

Compare this to rhs.

opCmp
int opCmp(MpZ rhs)
int opCmp(T rhs)

Compare this to rhs.

opEquals
bool opEquals(MpQ rhs)
int opEquals(T rhs)
toChars
char[] toChars(uint base, bool upperCaseDigits)

Convert in base base into chars of length length.

toHash
size_t toHash()

Get the hash suitable for use in a hash table.

toString
string toString(uint base, bool upperCaseDigits)

Convert to string in base base.

Properties

denominator
inout(MpZ) denominator [@property getter]
integerPart
MpZ integerPart [@property getter]
numerator
inout(MpZ) numerator [@property getter]
sgn
int sgn [@property getter]

Meta