MpZ

Arbitrary (multi) precision signed integer (Z). Wrapper for GNU MP (GMP)'s type mpz_t and functions mpz_.*.

Constructors

this
this()

No default construction.

this
this(typeof(null) )

Construct empty (undefined) from explicit null.

this
this(Expr expr)

Construct from expression expr.

this
this(T value)

Construct from value.

this
this(string value, uint base)

Construct from value in base base. If base is 0 it's guessed from contents of value.

this
this(MpZ value)

Construct copy of value.

this
this(MpZ value)

Construct copy of value.

Destructor

~this
~this()

Destruct this.

Postblit

this(this)
this(this)

Disable copy construction.

Members

Functions

absolute
void absolute()

Make this the absolute value of itself in-place.

dup
MpZ dup()
fitsIn
bool fitsIn()
fromString
MpZ fromString(string rhs, uint base)

Assign this from string rhs interpreted in base base. If base is 0 it's guessed from contents of value.

negate
void negate()

Negate this in-place.

opAssign
MpZ opAssign(MpZ rhs)
MpZ opAssign(Expr rhs)
MpZ opAssign(T rhs)

Assign from rhs.

opBinary
MpZ opBinary(MpZ rhs)
MpZ opBinary(Rhs rhs)
opBinary
MpZ opBinary(Rhs rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
MpZ opBinary(Rhs rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
Unqual!Rhs opBinary(Rhs rhs)

Remainer propagates modulus type.

opBinaryRight
MpZ opBinaryRight(Lhs lhs)
opBinaryRight
MpZ opBinaryRight(Lhs lhs)
opBinaryRight
Unqual!Lhs opBinaryRight(Lhs lhs)

Dividend propagates quotient type to signed.

opBinaryRight
MpZ opBinaryRight(Base base)

Exponentation.

opCast
bool opCast()

Cast to bool.

opCast
T opCast()

Cast to arithmetic type T.

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

Compare this to rhs.

opEquals
bool opEquals(MpZ rhs)
bool opEquals(Rhs rhs)
opOpAssign
MpZ opOpAssign(MpZ rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
MpZ opOpAssign(Rhs rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
MpZ opOpAssign(Rhs rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opUnary
inout(MpZ) opUnary()
opUnary
MpZ opUnary()
opUnary
MpZ opUnary()

Increase this by one.

opUnary
MpZ opUnary()

Decrease this by one.

sizeInBase
size_t sizeInBase(uint base)
swap
void swap(MpZ rhs)

Swap content of this with rhs.

toHash
size_t toHash()
Undocumented in source. Be warned that the author may not have intended to support it.
toInt
int toInt()
toLong
long toLong()
toString
string toString(uint base, bool upperCaseDigits)

Convert to string in base base.

unaryMinus
MpZ unaryMinus()

Manifest constants

useCopy
enum useCopy;

Use copy construction.

Properties

isEven
bool isEven [@property getter]

Check if this is odd.

isNegative
bool isNegative [@property getter]

Check if this is negative. TODO use as specialcase in opCmp

isOdd
bool isOdd [@property getter]

Check if this is odd. TODO use as specialcase in: this & 1

isPositive
bool isPositive [@property getter]

Check if this is positive.

isZero
bool isZero [@property getter]

Check if this is zero.

sgn
int sgn [@property getter]
uintLength
size_t uintLength [@property getter]

Number of significant uints used for storing this.

uintLong
size_t uintLong [@property getter]

Number of significant ulongs used for storing this.

Static functions

mersennePrime
MpZ mersennePrime(Integral p)
pow
typeof(this) pow(Base base, Exp exp)

Meta