envzn
0.8 · beta · not released

Library / System / Conversions / FloatBigInt

CLASS

FloatBigInt

Fields 1

int32 MAX_LIMBS

Constructors 1

INIT()

Methods 13

METHOD isZero() RETURNS boolean
reads
MODIFY METHOD setSmall(uint64 v) RETURNS void
modifies

Set to a value that fits in 64 bits.

MODIFY METHOD mulAddSmall(uint32 mul, uint32 add) RETURNS void
modifies

self := self * mul + add (mul, add each fit in 32 bits; mul >= 1).

METHOD pow10Small(int32 e) RETURNS uint32
reads

10^e for e in 0..8 (fits uint32; e<=8 keeps it under 10^9 < 2^32).

MODIFY METHOD mulPow10(int32 k) RETURNS void
modifies

self := self * 10^k (k >= 0). Chunked by 10^9 per pass (the largest power of ten a uint32 multiplier holds), then a final <10^9 remainder.

MODIFY METHOD setPow10(int32 k) RETURNS void
modifies

self := 10^k (k >= 0). The denominator-construction path.

MODIFY METHOD shiftLeftBits(int32 n) RETURNS void
modifies

self := self * 2^n

MODIFY METHOD appendLimbHi(uint32 v) RETURNS void
modifies

Append a limb as the new most-significant limb (internal builder for cloning self into a scratch value without passing SELF).

METHOD bitLength() RETURNS int32
reads

Number of significant bits (0 for zero). floor(log2(self)) + 1.

METHOD cloneBig() RETURNS FloatBigInt
reads

A fresh independent copy of self (reads own limbs, builds the copy through its own appendLimbHi — never passes SELF).

METHOD cmp(REFERENCE FloatBigInt other) RETURNS int32
reads

Ordering vs another big int: -1 (self < other), 0 (equal), 1 (self > other).

MODIFY METHOD addBig(REFERENCE FloatBigInt other) RETURNS void
modifies

self := self + other

MODIFY METHOD subBig(REFERENCE FloatBigInt other) RETURNS void
modifies

self := self - other (precondition: self >= other)