Exact currency amounts for Jennifer, on the
decimal library. An amount is an int of minor units with its ISO 4217
code, so it is exact, compares with == and stores as a plain number.
Multiplying, dividing and exchanging round to whole minor units in the mode
the caller names; allocate splits an amount without losing or creating a
cent; amounts of different currencies never mix.
jvc add @deckyard/moneyThis vendors the deck to vendor/<scope>/money/. Without jvc, unpack the
src/ subtree of a release archive (<scope>-money-<version>.tar.gz) there.
import "@deckyard/money/" as money;
def net as money.Money init money.parse("19.99", "EUR");
def gross as money.Money init money.multiply($net, "1.19", "half-up");
io.printf("%s EUR\n", money.format($gross)); # 23.79 EUR
for (def part in money.allocate($gross, ["1", "1", "1"])) {
io.printf("%s ", money.format($part)); # 7.93 7.93 7.93
}
Jennifer 0.26.0 or newer, jennifer or jennifer-tiny. No capabilities:
the deck is pure computation.
tools/check-all.sh # the full gate, as CI runs it
jennifer test src/money_test.j # the test overlay
tools/gen-currencies.sh # refresh the ISO 4217 table
tools/check-docs.sh # docs against the code
tools/pack.sh dist # build the release archiveLGPL-3.0-only, see LICENSE. Copyright (C) 2026 mplx <mplx@jennifer-lang.dev>.
tools/check-headers.sh checks every source file's SPDX header against
deck.toml.