bigint
Provides a BigInt struct for multiprecision integer arithmetic.
The internal representation is binary, not decimal.
All relevant operators are overloaded.
Example:
BigInt a = "9588669891916142";
BigInt b = "7452469135154800";
auto c = a * b;
assert(c == "71459266416693160362545788781600");
auto d = b * a;
assert(d == "71459266416693160362545788781600");
assert(d == c);
d = c * "794628672112";
assert(d == "56783581982794522489042432639320434378739200");
auto e = c + d;
assert(e == "56783581982865981755459125799682980167520800");
auto f = d + c;
assert(f == e);
auto g = f - c;
assert(g == d);
g = f - d;
assert(g == c);
e = 12345678;
g = c + e;
auto h = g / b;
auto i = g % b;
assert(h == a);
assert(i == e);
Authors:Janice Caron
Date:2008.05.18
License:Public Domain
- alias for uint
- Struct representing a multiprecision integer
void
opAssign(const BigInt
n);
-
-
-
-
-
-
-
const void
castTo(out BigInt
r);
-
const void
castTo(out int
r);
-
const void
castTo(out uint
r);
-
const void
castTo(out long
r);
-
const void
castTo(out ulong
r);
-
const void
castTo(out string
r);
-
-
-
-
-
-
-
BigInt
opAdd(T : int)(T
n);
-
BigInt
opAdd(T : const(BigInt))(T
n);
-
void
opAddAssign(T)(T
n);
-
-
BigInt
opSub(T : int)(T
n);
-
BigInt
opSub(T : const(BigInt))(T
n);
-
void
opSubAssign(T)(T
n);
-
-
BigInt
opMul(T : int)(T
n);
-
BigInt
opMul(T : const(BigInt))(T
n);
-
void
opMulAssign(T)(T
n);
-
-
BigInt
opDiv(T : int)(T
n);
-
BigInt
opDiv(T : const(BigInt))(T
n);
-
void
opDivAssign(T)(T
n);
-
-
-
BigInt
opMod(T : const(BigInt))(T
n);
-
void
opModAssign(T : int)(T
n);
-
void
opModAssign(T)(T
n);
-
-
BigInt
opAnd(T : int)(T
n);
-
uint
opAnd(T : uint)(T
n);
-
BigInt
opAnd(T : const(BigInt))(T
n);
-
void
opAndAssign(T : uint)(T
n);
-
void
opAndAssign(T)(T
n);
-
-
BigInt
opOr(T : int)(T
n);
-
BigInt
opOr(T : const(BigInt))(T
n);
-
-
-
BigInt
opXor(T : int)(T
n);
-
BigInt
opXor(T : const(BigInt))(T
n);
-
void
opXorAssign(T)(T
n);
-
const BigInt
opShl(uint
n);
-
void
opShlAssign(uint
n);
-
const BigInt
opShr(uint
n);
-
void
opShrAssign(uint
n);
-
-
void
opUShrAssign(T)(T
n);
-
-
int
opEquals(T : int)(T
n);
-
int
opEquals(T : const(BigInt))(T
n);
-
-
-
int
opCmp(T : const(BigInt))(T
n);
-
-
-