Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

mir.bignum.low_level_view

Low-level betterC utilities for big integer arithmetic libraries.

Note The module doesn't provide full arithmetic API for now.

enum WordEndian: int;
little
big
enum WordEndian TargetEndian;
pure nothrow @nogc @safe T ceilLog10Exp2(T)(const T e)
if (is(T == ubyte) || is(T == ushort) || is(T == uint) || is(T == ulong));
Fast integer computation of ceil(log10(exp2(e))) with 64-bit mantissa precision. The result is guaranted to be greater then log10(exp2(e)), which is irrational number.
Examples:
assert(ceilLog10Exp2(ubyte(10)) == 4); // ubyte
assert(ceilLog10Exp2(10U) == 4); // uint
assert(ceilLog10Exp2(10UL) == 4); // ulong
struct BigUIntView(W, WordEndian endian = TargetEndian) if (__traits(isUnsigned, W));
Arbitrary length unsigned integer view.
Examples:
import std.traits;
alias AliasSeq(T...) = T;

foreach (T; AliasSeq!(ubyte, ushort, uint, ulong))
foreach (endian; AliasSeq!(WordEndian.little, WordEndian.big))
{
    static if (endian == WordEndian.little)
    {
        T[3] lhsData = [1, T.max-1, 0];
        T[3] rhsData = [T.max, T.max, 0];
    }
    else
    {
        T[3] lhsData = [0, T.max-1, 1];
        T[3] rhsData = [0, T.max, T.max];
    }

    auto lhs = BigUIntView!(T, endian)(lhsData).normalized;

    /// bool overflow = bigUInt op= scalar
    assert(lhs.leastSignificantFirst == [1, T.max-1]);
    assert(lhs.mostSignificantFirst == [T.max-1, 1]);
    static if (T.sizeof >= 4)
    {
        assert((lhs += T.max) == false);
        assert(lhs.leastSignificantFirst == [0, T.max]);
        assert((lhs += T.max) == false);
        assert((lhs += T.max) == true); // overflow bit
        assert(lhs.leastSignificantFirst == [T.max-1, 0]);
        assert((lhs -= T(1)) == false);
        assert(lhs.leastSignificantFirst == [T.max-2, 0]);
        assert((lhs -= T.max) == true); // underflow bit
        assert(lhs.leastSignificantFirst == [T.max-1, T.max]);
        assert((lhs -= Signed!T(-4)) == true); // overflow bit
        assert(lhs.leastSignificantFirst == [2, 0]);
        assert((lhs += Signed!T.max) == false); // overflow bit
        assert(lhs.leastSignificantFirst == [Signed!T.max + 2, 0]);

        ///  bool overflow = bigUInt op= bigUInt/bigInt
        lhs = BigUIntView!(T, endian)(lhsData);
        auto rhs = BigUIntView!(T, endian)(rhsData).normalized;
        assert(lhs.leastSignificantFirst == [Signed!T.max + 2, 0, 0]);
        assert(rhs.leastSignificantFirst == [T.max, T.max]);
        assert((lhs += rhs) == false);
        assert(lhs.leastSignificantFirst == [Signed!T.max + 1, 0, 1]);
        assert((lhs -= rhs) == false);
        assert(lhs.leastSignificantFirst == [Signed!T.max + 2, 0, 0]);
        assert((lhs += -rhs) == true);
        assert(lhs.leastSignificantFirst == [Signed!T.max + 3, 0, T.max]);
        assert((lhs += -(-rhs)) == true);
        assert(lhs.leastSignificantFirst == [Signed!T.max + 2, 0, 0]);

        /// W overflow = bigUInt *= scalar
        assert((lhs *= T.max) == 0);
        assert((lhs += T(Signed!T.max + 2)) == false);
        assert(lhs.leastSignificantFirst == [0, Signed!T.max + 2, 0]);
        lhs = lhs.normalized;
        lhs.leastSignificantFirst[1] = T.max / 2 + 3;
        assert(lhs.leastSignificantFirst == [0, T.max / 2 + 3]);
        assert((lhs *= 8u) == 4);
        assert(lhs.leastSignificantFirst == [0, 16]);
    }
}
W[] coefficients;
A group of coefficients for a radix W.max + 1.
The order corresponds to endianness.
pure nothrow @nogc @property scope @safe BigIntView!(W, endian) signed()();

Retrurns signed integer view using the same data payload

const scope T opCast(T, bool wordNormalized = false, bool nonZero = false)()
if (isFloatingPoint!T && isMutable!T);
Examples:
auto a = cast(double) BigUIntView!size_t.fromHexString("afbbfae3cd0aff2714a1de7022b0029d");
assert(a == 0xa.fbbfae3cd0bp+124);
assert(cast(double) BigUIntView!size_t.init == 0);
assert(cast(double) BigUIntView!size_t([0]) == 0);
const scope @safe T opCast(T : Fp!coefficientSize, size_t internalRoundLastBits = 0, bool wordNormalized = false, bool nonZero = false, size_t coefficientSize)()
if (internalRoundLastBits < size_t.sizeof * 8 && (size_t.sizeof >= W.sizeof || endian == TargetEndian));
Examples:
import mir.bignum.fp: Fp;
import mir.bignum.fixed: UInt;

auto fp = cast(Fp!128) BigUIntView!ulong.fromHexString("afbbfae3cd0aff2714a1de7022b0029d");
assert(fp.exponent == 0);
assert(fp.coefficient == UInt!128.fromHexString("afbbfae3cd0aff2714a1de7022b0029d"));

fp = cast(Fp!128) BigUIntView!uint.fromHexString("ae3cd0aff2714a1de7022b0029d");
assert(fp.exponent == -20);
assert(fp.coefficient == UInt!128.fromHexString("ae3cd0aff2714a1de7022b0029d00000"));

fp = cast(Fp!128) BigUIntView!ushort.fromHexString("e7022b0029d");
assert(fp.exponent == -84);
assert(fp.coefficient == UInt!128.fromHexString("e7022b0029d000000000000000000000"));

fp = cast(Fp!128) BigUIntView!ubyte.fromHexString("e7022b0029d");
assert(fp.exponent == -84);
assert(fp.coefficient == UInt!128.fromHexString("e7022b0029d000000000000000000000"));

fp = cast(Fp!128) BigUIntView!size_t.fromHexString("e7022b0029d");
assert(fp.exponent == -84);
assert(fp.coefficient == UInt!128.fromHexString("e7022b0029d000000000000000000000"));

fp = cast(Fp!128) BigUIntView!size_t.fromHexString("ffffffffffffffffffffffffffffffff1000000000000000");
assert(fp.exponent == 64);
assert(fp.coefficient == UInt!128.fromHexString("ffffffffffffffffffffffffffffffff"));

fp = cast(Fp!128) BigUIntView!size_t.fromHexString("ffffffffffffffffffffffffffffffff8000000000000000");
assert(fp.exponent == 65);
assert(fp.coefficient == UInt!128.fromHexString("80000000000000000000000000000000"));

fp = cast(Fp!128) BigUIntView!size_t.fromHexString("fffffffffffffffffffffffffffffffe8000000000000000");
assert(fp.exponent == 64);
assert(fp.coefficient == UInt!128.fromHexString("fffffffffffffffffffffffffffffffe"));

fp = cast(Fp!128) BigUIntView!size_t.fromHexString("fffffffffffffffffffffffffffffffe8000000000000001");
assert(fp.exponent == 64);
assert(fp.coefficient == UInt!128.fromHexString("ffffffffffffffffffffffffffffffff"));
const scope T opCast(T, bool nonZero = false)()
if (isIntegral!T && isUnsigned!T && isMutable!T);
Examples:
auto view = BigUIntView!ulong.fromHexString("afbbfae3cd0aff2714a1de7022b0029d");
assert(cast(ulong) view == 0x14a1de7022b0029d);
assert(cast(uint) view == 0x22b0029d);
assert(cast(ubyte) view == 0x9d);
pure nothrow @nogc scope @trusted BigUIntView!V opCast(T : BigUIntView!V, V)() return
if (V.sizeof <= W.sizeof);
const pure nothrow @nogc @property scope @safe BigUIntView!(const(W), endian) lightConst()() return;
const pure nothrow @nogc scope @safe sizediff_t opCmp(scope BigUIntView!(const(W), endian) rhs);
const pure nothrow @nogc scope @safe bool opEquals(scope BigUIntView!(const(W), endian) rhs);
inout @property ref scope inout(W) mostSignificant() return;
inout @property ref scope inout(W) leastSignificant() return;
scope void popMostSignificant();
scope void popLeastSignificant();
scope BigUIntView topMostSignificantPart(size_t length) return;
scope BigUIntView topLeastSignificantPart(size_t length) return;
scope void smallLeftShiftInPlace()(uint shift);
Shifts left using at most size_t.sizeof * 8 - 1 bits
Examples:
auto a = BigUIntView!size_t.fromHexString("afbbfae3cd0aff2714a1de7022b0029d");
a.smallLeftShiftInPlace(4);
assert(a == BigUIntView!size_t.fromHexString("fbbfae3cd0aff2714a1de7022b0029d0"));
a.smallLeftShiftInPlace(0);
assert(a == BigUIntView!size_t.fromHexString("fbbfae3cd0aff2714a1de7022b0029d0"));
void smallRightShiftInPlace()(uint shift);
Shifts right using at most size_t.sizeof * 8 - 1 bits
Examples:
auto a = BigUIntView!size_t.fromHexString("afbbfae3cd0aff2714a1de7022b0029d");
a.smallRightShiftInPlace(4);
assert(a == BigUIntView!size_t.fromHexString("afbbfae3cd0aff2714a1de7022b0029"));
pure @trusted BigUIntView fromHexString(C)(scope const(C)[] str)
if (isSomeChar!C);
pure nothrow @nogc scope @safe bool fromHexStringImpl(C)(scope const(C)[] str)
if (isSomeChar!C);
pure nothrow @nogc @safe bool fromStringImpl(C)(scope const(C)[] str)
if (isSomeChar!C);
Returns:
false in case of overflow or incorrect string.

Precondition non-empty coefficients

Note doesn't support signs.

pure nothrow @nogc scope @safe bool opOpAssign(string op)(scope BigUIntView!(const(W), endian) rhs, bool overflow = false)
if (op == "+" || op == "-");

pure nothrow @nogc scope @safe bool opOpAssign(string op)(scope BigIntView!(const(W), endian) rhs, bool overflow = false)
if (op == "+" || op == "-");
Performs bool overflow = big +(-)= big operatrion.
Parameters:
BigUIntView!(const(W), endian) rhs value to add with non-empty coefficients
bool overflow (overflow) initial iteration overflow

Precondition non-empty coefficients length of greater or equal to the rhs coefficients length.

Returns:
true in case of unsigned overflow
pure nothrow @nogc scope @safe bool opOpAssign(string op, T)(const T rhs)
if ((op == "+" || op == "-") && is(T == W));

pure nothrow @nogc scope @safe bool opOpAssign(string op, T)(const T rhs)
if ((op == "+" || op == "-") && is(T == Signed!W));
Performs bool Overflow = big +(-)= scalar operatrion.

Precondition non-empty coefficients

Parameters:
T rhs value to add
Returns:
true in case of unsigned overflow
pure nothrow @nogc scope @safe W opOpAssign(string op : "*")(W rhs, W overflow = 0u);
Performs W overflow = (big += overflow) *= scalar operatrion.

Precondition non-empty coefficients

Parameters:
W rhs unsigned value to multiply by
W overflow initial overflow
Returns:
unsigned overflow value
pure nothrow @nogc scope @safe uint opOpAssign(string op : "/")(uint rhs, uint overflow = 0);
Performs uint remainder = (overflow$big) /= scalar operatrion, where $ denotes big-endian concatenation.

Precondition non-empty coefficients, overflow < rhs

Parameters:
uint rhs unsigned value to devide by
uint overflow initial unsigned overflow
Returns:
unsigned remainder value (evaluated overflow)
pure nothrow @nogc scope @safe UInt!size opOpAssign(string op : "*", size_t size)(UInt!size rhs, UInt!size overflow = 0);
Performs W overflow = (big += overflow) *= scalar operatrion.

Precondition non-empty coefficients

Parameters:
UInt!size rhs unsigned fixed-length integer to multiply by
UInt!size overflow initial overflow
Returns:
unsigned fixed-length integer overflow value
scope BigIntView!(W, endian) opUnary(string op : "-")() return;
Returns:
the same intger view with inversed sign
scope void bitwiseNotInPlace();
scope bool twoComplementInPlace();
Performs number=-number operatrion.

Precondition non-empty coefficients

Returns:
true if 'number=-number=0' and false otherwise
pure nothrow @nogc @property scope @safe auto leastSignificantFirst() return;
Returns:
a slice of coefficients starting from the least significant.
const pure nothrow @nogc @property scope @safe auto leastSignificantFirst() return;
pure nothrow @nogc @property scope @safe auto mostSignificantFirst() return;
Returns:
a slice of coefficients starting from the most significant.
const pure nothrow @nogc @property scope @safe auto mostSignificantFirst() return;
scope BigUIntView normalized() return;

const scope BigUIntView!(const(W), endian) normalized();
Strips most significant zero coefficients.
scope bool bt()(size_t position);
const pure nothrow @nogc @property scope @safe size_t ctlz()();
const pure nothrow @nogc @property scope @safe size_t cttz()();
BigIntView!(W, endian) withSign()(bool sign);
const pure nothrow @nogc scope @safe bool get(U)(out scope U value)
if (isUnsigned!U);
Parameters:
U value (out) unsigned integer
Returns:
true on success
const pure nothrow @nogc scope @safe bool opEquals(ulong rhs);
Returns:
true if the integer and equals to rhs.
pure nothrow @nogc @safe size_t toStringImpl(C)(scope C[] str)
if (isSomeChar!C && isMutable!C);
Parameters:
C[] str string buffer, the tail paer

Precondition mutable number with word size at least 4 bytes

Postconditoin the number is destroyed

Returns:
last N bytes used in the buffer
Examples:
import mir.bignum.integer;

auto a = BigInt!2("123456789098765432123456789098765432100");
char[ceilLog10Exp2(a.data.length * (size_t.sizeof * 8))] buffer;
auto len = a.view.unsigned.toStringImpl(buffer);
assert(buffer[$ - len .. $] == "123456789098765432123456789098765432100");
struct BigIntView(W, WordEndian endian = TargetEndian) if (is(Unqual!W == ubyte) || is(Unqual!W == ushort) || is(Unqual!W == uint) || is(Unqual!W == ulong));
Arbitrary length signed integer view.
Examples:
import std.traits;
alias AliasSeq(T...) = T;

foreach (T; AliasSeq!(ubyte, ushort, uint, ulong))
foreach (endian; AliasSeq!(WordEndian.little, WordEndian.big))
{
    static if (endian == WordEndian.little)
    {
        T[3] lhsData = [1, T.max-1, 0];
        T[3] rhsData = [T.max, T.max, 0];
    }
    else
    {
        T[3] lhsData = [0, T.max-1, 1];
        T[3] rhsData = [0, T.max, T.max];
    }

    auto lhs = BigIntView!(T, endian)(lhsData).normalized;

    ///  bool overflow = bigUInt op= scalar
    assert(lhs.leastSignificantFirst == [1, T.max-1]);
    assert(lhs.mostSignificantFirst == [T.max-1, 1]);

    static if (T.sizeof >= 4)
    {

        assert((lhs += T.max) == false);
        assert(lhs.leastSignificantFirst == [0, T.max]);
        assert((lhs += T.max) == false);
        assert((lhs += T.max) == true); // overflow bit
        assert(lhs.leastSignificantFirst == [T.max-1, 0]);
        assert((lhs -= T(1)) == false);
        assert(lhs.leastSignificantFirst == [T.max-2, 0]);
        assert((lhs -= T.max) == false);
        assert(lhs.leastSignificantFirst == [2, 0]);
        assert(lhs.sign);
        assert((lhs -= Signed!T(-4)) == false);
        assert(lhs.leastSignificantFirst == [2, 0]);
        assert(lhs.sign == false);
        assert((lhs += Signed!T.max) == false);
        assert(lhs.leastSignificantFirst == [Signed!T.max + 2, 0]);

        ///  bool overflow = bigUInt op= bigUInt/bigInt
        lhs = BigIntView!(T, endian)(lhsData);
        auto rhs = BigUIntView!(T, endian)(rhsData).normalized;
        assert(lhs.leastSignificantFirst == [Signed!T.max + 2, 0, 0]);
        assert(rhs.leastSignificantFirst == [T.max, T.max]);
        assert((lhs += rhs) == false);
        assert(lhs.leastSignificantFirst == [Signed!T.max + 1, 0, 1]);
        assert((lhs -= rhs) == false);
        assert(lhs.leastSignificantFirst == [Signed!T.max + 2, 0, 0]);
        assert((lhs += -rhs) == false);
        assert(lhs.sign);
        assert(lhs.leastSignificantFirst == [T.max - (Signed!T.max + 2), T.max, 0]);
        assert(lhs.sign);
        assert((lhs -= -rhs) == false);
        assert(lhs.leastSignificantFirst == [Signed!T.max + 2, 0, 0]);
        assert(lhs.sign == false);
    }
}
Examples:
import mir.bignum.fixed: UInt;
import mir.bignum.low_level_view: BigUIntView;
auto bigView = BigUIntView!size_t.fromHexString("55a325ad18b2a77120d870d987d5237473790532acab45da44bc07c92c92babf0b5e2e2c7771cd472ae5d7acdb159a56fbf74f851a058ae341f69d1eb750d7e3");
auto fixed = UInt!256.fromHexString("55e5669576d31726f4a9b58a90159de5923adc6c762ebd3c4ba518d495229072");
auto overflow = bigView *= fixed;
assert(overflow == UInt!256.fromHexString("1cbbe8c42dc21f936e4ce5b2f52ac404439857f174084012fcd1b71fdec2a398"));
assert(bigView == BigUIntView!size_t.fromHexString("c73fd2b26f2514c103c324943b6c90a05d2732118d5f0099c36a69a8051bb0573adc825b5c9295896c70280faa4c4d369df8e92f82bfffafe078b52ae695d316"));
BigUIntView!(W, endian) unsigned;
Self-assigned to unsigned integer view BigUIntView..
Sign is stored in the most significant bit.
The number is encoded as pair of unsigned and sign.
bool sign;
Sign bit
inout @property scope inout(W)[] coefficients() return;
this(W[] coefficients, bool sign = false);
this(BigUIntView!(W, endian) unsigned, bool sign = false);
pure nothrow @nogc @safe bool fromStringImpl(C)(scope const(C)[] str)
if (isSomeChar!C);
Returns:
false in case of overflow or incorrect string.

Precondition non-empty coefficients.

pure @trusted BigIntView fromHexString(C)(scope const(C)[] str)
if (isSomeChar!C);
pure nothrow @nogc @safe bool fromHexStringImpl(C)(scope const(C)[] str)
if (isSomeChar!C);
const scope T opCast(T, bool wordNormalized = false, bool nonZero = false)()
if (isFloatingPoint!T && isMutable!T);
Examples:
auto a = cast(double) BigIntView!size_t.fromHexString("-afbbfae3cd0aff2714a1de7022b0029d");
assert(a == -0xa.fbbfae3cd0bp+124);
const scope T opCast(T, bool nonZero = false)()
if (is(T == long) || is(T == int));
Examples:
auto view = BigIntView!size_t.fromHexString("-afbbfae3cd0aff2714a1de7022b0021d");
assert(cast(long) view == -0x14a1de7022b0021d);
assert(cast(int) view == -0x22b0021d);
const scope T opCast(T : Fp!coefficientSize, size_t internalRoundLastBits = 0, bool wordNormalized = false, bool nonZero = false, size_t coefficientSize)()
if (internalRoundLastBits < size_t.sizeof * 8 && (size_t.sizeof >= W.sizeof || endian == TargetEndian));
Examples:
import mir.bignum.fixed: UInt;
import mir.bignum.fp: Fp;

auto fp = cast(Fp!128) BigIntView!size_t.fromHexString("-afbbfae3cd0aff2714a1de7022b0029d");
assert(fp.sign);
assert(fp.exponent == 0);
assert(fp.coefficient == UInt!128.fromHexString("afbbfae3cd0aff2714a1de7022b0029d"));
scope BigIntView!V opCast(T : BigIntView!V, V)() return
if (V.sizeof <= W.sizeof);
const pure nothrow @nogc @property scope @safe BigIntView!(const(W), endian) lightConst()() return;
const pure nothrow @nogc scope @safe sizediff_t opCmp(BigIntView!(const(W), endian) rhs);
const pure nothrow @nogc scope @safe bool opEquals(BigIntView!(const(W), endian) rhs);
const pure nothrow @nogc scope @safe bool opEquals(long rhs);
Returns:
true if the integer and equals to rhs.
BigIntView topMostSignificantPart(size_t length);
BigIntView topLeastSignificantPart(size_t length);
pure nothrow @nogc @safe bool opOpAssign(string op)(scope BigIntView!(const(W), endian) rhs, bool overflow = false)
if (op == "+" || op == "-");

pure nothrow @nogc @safe bool opOpAssign(string op)(scope BigUIntView!(const(W), endian) rhs, bool overflow = false)
if (op == "+" || op == "-");
Performs bool overflow = big +(-)= big operatrion.
Parameters:
BigIntView!(const(W), endian) rhs value to add with non-empty coefficients
bool overflow (overflow) initial iteration overflow

Precondition non-empty coefficients length of greater or equal to the rhs coefficients length.

Returns:
true in case of unsigned overflow
pure nothrow @nogc @safe bool opOpAssign(string op, T)(const T rhs)
if ((op == "+" || op == "-") && is(T == Signed!W));

pure nothrow @nogc @safe bool opOpAssign(string op, T)(const T rhs)
if ((op == "+" || op == "-") && is(T == W));
Performs bool overflow = big +(-)= scalar operatrion.

Precondition non-empty coefficients

Parameters:
T rhs value to add
Returns:
true in case of unsigned overflow
pure nothrow @nogc @safe W opOpAssign(string op : "*")(W rhs, W overflow = 0u);
Performs W overflow = (big += overflow) *= scalar operatrion.

Precondition non-empty coefficients

Parameters:
W rhs unsigned value to multiply by
W overflow initial overflow
Returns:
unsigned overflow value
BigIntView opUnary(string op : "-")();
Returns:
the same intger view with inversed sign
pure nothrow @nogc @property @safe auto leastSignificantFirst();
Returns:
a slice of coefficients starting from the least significant.
pure nothrow @nogc @property @safe auto mostSignificantFirst();
Returns:
a slice of coefficients starting from the most significant.
BigIntView normalized();

const BigIntView!(const(W), endian) normalized();
Strips zero most significant coefficients. Strips most significant zero coefficients. Sets sign to zero if no coefficients were left.
struct BigUIntAccumulator(W, WordEndian endian = TargetEndian) if (is(Unqual!W == uint) || is(Unqual!W == ulong));
An utility type to wrap a local buffer to accumulate unsigned numbers.
Examples:
import std.traits;
alias AliasSeq(T...) = T;

foreach (T; AliasSeq!(uint, ulong))
foreach (endian; AliasSeq!(WordEndian.little, WordEndian.big))
{
    T[16 / T.sizeof] buffer;
    auto accumulator = BigUIntAccumulator!(T, endian)(buffer);
    assert(accumulator.length == 0);
    assert(accumulator.coefficients.length == buffer.length);
    assert(accumulator.view.coefficients.length == 0);
    // needs to put a number before any operations on `.view`
    accumulator.put(1);
    // compute N factorial
    auto N = 30;
    foreach(i; 1 .. N + 1)
    {
        if (auto overflow = accumulator.view *= i)
        {
            if (!accumulator.canPut)
                throw new Exception("Factorial buffer overflow");
            accumulator.put(overflow);
        }
    }
    assert(accumulator.view == BigUIntView!(T, endian).fromHexString("D13F6370F96865DF5DD54000000"));
}
Examples:
Computes 13 * 10^^60
uint[7] buffer;
auto accumulator = BigUIntAccumulator!uint(buffer);
accumulator.put(13); // initial value
assert(accumulator.approxCanMulPow5(60));
accumulator.mulPow5(60);
assert(accumulator.canMulPow2(60));
accumulator.mulPow2(60);
assert(accumulator.view == BigUIntView!uint.fromHexString("81704fcef32d3bd8117effd5c4389285b05d000000000000000"));
W[] coefficients;
A group of coefficients for a DecimalRadix.!W.
The order corresponds to endianness.
The unused part can be uninitialized.
size_t length;
Current length of initialized coefficients.
The initialization order corresponds to endianness.
The view method may return a view with empty coefficients, which isn't usable. Put 0 or another number first to make the accumulator maintain a non-empty view.
pure nothrow @nogc @property @safe BigUIntView!(W, endian) view();
Returns:
Current unsigned integer view.

Note The method may return a view with empty coefficients, which isn't usable. Put 0 or another number first to make the accumulator maintain a non-empty view.

@property bool canPut();
Returns:
True if the accumulator can accept next most significant coefficient
void put(W coeffecient);
Places coefficient to the next most significant position.
void normalize();
Strips most significant zero coefficients from the current view.

Note The view method may return a view with empty coefficients, which isn't usable. Put 0 or another number first to make the accumulator maintain a non-empty view.

bool canPutN(size_t n);
bool approxCanMulPow5(size_t degree);
bool canMulPow2(size_t degree);
void mulPow5(size_t degree);
scope @safe void mulPow2(size_t degree);
enum DecimalExponentKey: int;
none
infinity
nan
dot
d
e
D
E
struct DecimalView(W, WordEndian endian = TargetEndian, Exp = sizediff_t) if (isUnsigned!W);
bool sign;
Exp exponent;
BigUIntView!(W, endian) coefficient;
pure nothrow @nogc @safe bool fromStringImpl(C, bool allowSpecialValues = true, bool allowDotOnBounds = true, bool allowDExponent = true, bool allowStartingPlus = true, bool allowUnderscores = true, bool allowLeadingZeros = true, bool allowExponent = true, bool checkEmpty = true)(scope const(C)[] str, out DecimalExponentKey key, int exponentShift = 0)
if (isSomeChar!C);
Returns:
false in case of overflow or incorrect string.

Precondition non-empty coefficients

const pure nothrow @nogc @property @safe DecimalView!(const(W), endian, Exp) lightConst()();
BigIntView!(W, endian) signedCoefficient();
const scope T opCast(T, bool wordNormalized = false, bool nonZero = false)()
if (isFloatingPoint!T && isMutable!T);
Mir parsing supports up-to quadruple precision. The conversion error is 0 ULP for normal numbers. Subnormal numbers with an exponent greater than or equal to -512 have upper error bound equal to 1 ULP.
struct BinaryView(W, WordEndian endian = TargetEndian, Exp = int);
bool sign;
Exp exponent;
BigUIntView!(W, endian) coefficient;
const pure nothrow @nogc @property @safe DecimalView!(const(W), endian, Exp) lightConst()();
BigIntView!(W, endian) signedCoefficient();