Tagged money
13 capabilities
money.split-even
Split an amount into n near-equal parts that add back up to exactly the whole.
splitEven in TypeScript
math.round-div
Integer division with an explicit rounding mode, for money arithmetic that must not drift.
roundDiv in TypeScript
math.round-div-big
Divide two integers of any size with an explicit rounding mode, on decimal strings, for exact money sums past 2^53.
roundDivBig in TypeScript
money.add
Add, subtract and negate monetary amounts, refusing to mix currencies.
addMoney in TypeScript
money.allocate
Split an amount across ratios without losing or inventing a single minor unit.
allocate in TypeScript
money.apply-rate
Apply a rate expressed in basis points to a monetary amount, with an explicit rounding mode.
applyRate in TypeScript
money.compare
Compare two amounts of one currency, refusing to compare across currencies; min, max and clamp too.
A group of 4:
compareMoney, minMoney, maxMoney, clampMoney
money.convert
Convert an amount to another currency at a supplied exact rate, with an explicit rounding mode.
convertMoney in TypeScript
money.currency-digits
How many decimal places a currency's minor unit has, from the ISO 4217 list.
currencyDigits in TypeScript
money.format
Render a monetary amount as text, using the currency's real minor-unit precision.
formatMoney in TypeScript
money.parse
Parse "£1,234.50" or "1.234,50 €" into integer minor units, strictly: no guessing, no rounding.
parseMoney in TypeScript
money.sum
Total a list of monetary amounts, with an explicit currency for the empty case.
sumMoney in TypeScript