Normalises a decimal string by stripping trailing fractional
zeros (mirrors Precise.reduce() + toString()). Falls back to
the input on overflow / parse failure.
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.
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.