Skip to main content

Module precise

Module precise 

Source

Structs§

Precise
A struct wrapper matching CCXT Precise class usage (e.g. Precise::string_add).

Functions§

reduce_string
Normalises a decimal string by stripping trailing fractional zeros (mirrors Precise.reduce() + toString()). Falls back to the input on overflow / parse failure.
string_abs
string_add
string_div
a / b rounded half to even at the largest scale (at most 28) whose integer stays below 2^96, then trailing zeros trimmed.
string_div_prec
Port of Precise.stringDiv (a, b, precision) — truncating big-integer division to exactly precision decimal places.
string_div_prec_big
Arbitrary-precision port of Precise.stringDiv (a, b, precision). Mirrors the TS BigInt algorithm exactly; used when the i128 fast path in string_div_prec would overflow.
string_eq
string_ge
string_gt
string_le
string_lt
string_mod
string_mul
string_neg
string_sub
string_to_precision
Round to decimals decimal places using the specified rounding mode. mode 0 = truncate (keeps a - on a negative input truncated to zero), 3 = ceiling, 4 = floor, any other = round half to even.