larzmoney
Exact money, never a float.
Represents money as integer minor units plus a currency, so arithmetic is always exact and splitting never loses or invents a penny. Refuses to mix currencies without an explicit conversion.
larzscript pkg install money
What you get
- Exact integer-minor-unit money
- split()/allocate() that always reconcile
- Seven rounding modes incl. banker's
- ISO-4217 registry + custom currencies
Try it
import "money" as money
let m = money.of("10.99", "USD")
print(money.str_(m))
print(money.str_(money.percent(money.of("10.00", "USD"), "8.25")))
let parts = money.split(money.of("100.00", "USD"), 3)
for p in parts { print(money.str_(p)) }
let fx = money.exchange_new("USD")
money.exchange_add(fx, "EUR", "0.92")
print(money.str_(money.exchange_convert(fx, money.of("100", "USD"), "EUR")))Output
10.99 USD 0.83 USD 33.34 USD 33.33 USD 33.33 USD 92.00 EUR
Why it's in the Larz Stack
larzmoney is a real Larzscript package (larzscript pkg install money) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.