@internal
This page tracks the current repository implementation and is written as the 0.2.0 API baseline.
@internal is an implementation-facing package. Its functions are documented here for maintainers and advanced contributors, not as a stable public API promise.
BigInt Helpers
fn bigint_zero() -> BigIntReturns0as aBigInt.fn bigint_one() -> BigIntReturns1as aBigInt.fn abs_bigint(x : BigInt) -> BigIntReturns the absolute value ofx.fn sign_of_bigint(x : BigInt) -> SignConverts aBigIntsign intoSign::Negative,Sign::Zero, orSign::Positive.
Power Helpers
fn pow2(n : Int) -> BigIntReturns2^n. Rejects negativen.fn pow5(n : Int) -> BigIntReturns5^n. Rejects negativen.fn pow10(n : Int) -> BigIntReturns10^n. Rejects negativen.fn digits10(x : BigInt) -> IntReturns the decimal digit count of the absolute value ofx.
Normalization Helpers
fn remove_factor2(sig : BigInt, exp : Int) -> (BigInt, Int)Removes all factors of2fromsigand compensates them into the returned exponent.fn remove_factor10(coeff : BigInt, exp : Int) -> (BigInt, Int)Removes all factors of10fromcoeffand compensates them into the returned exponent.
Rounding Helpers
fn round_positive_div(numerator : BigInt, denominator : BigInt, negative : Bool, mode : RoundingMode) -> BigIntRounds the positive quotientnumerator / denominatoraccording tomode. Thenegativeflag lets the routine interpret directed rounding correctly for signed values.fn round_shift(magnitude : BigInt, shift : Int, negative : Bool, mode : RoundingMode) -> BigIntRounds a right-shift-by-shiftoperation on a non-negative magnitude.fn compare_abs(a : BigInt, b : BigInt) -> IntCompares absolute values only.
Decimal Parsing Helper
fn split_decimal_string(src : String) -> (Bool, String, Int)?Splits a decimal string into:- sign flag
- digit string without separators
- base-10 exponent adjustment
It accepts plain decimals and scientific notation in the currently implemented parser.