units.convert
Convert length, mass, area, volume, temperature and energy between units, exactly, as decimal text.
convert_units in Rust
1.0.0
py rs ts
31 tests
units.parse-quantity
Parse "2.5 kg", "1,200 m" or "12 ft 6 in" into an exact decimal value and a canonical unit symbol, strictly.
parse_quantity in Rust
1.0.0
py rs ts
31 tests
money.currency-digits
How many decimal places a currency's minor unit has, from the ISO 4217 list.
currency_digits in Rust
1.0.0
py rs ts
14 tests
agri.stocking-rate
Stocking rate: livestock units and LU per hectare from animal numbers, by a published LU coefficient table.
stocking_rate in Rust
1.0.1
py rs ts
17 tests
retail.price-per-unit
Unit price for shelf-edge labels: price per kg, per 100 g, per litre, per 100 ml, per metre or per item.
unit_price in Rust
1.0.1
py rs ts
27 tests
energy.price-cap
Ofgem energy price cap unit rate and daily standing charge for a fuel and payment method on a date (GB average).
price_cap in Rust
1.0.2
py rs ts
19 tests
time.round-to-increment
Round a duration in minutes to a billing increment such as 6 or 15 minutes, up, down or to nearest.
round_to_increment in Rust
1.0.0
py rs ts
18 tests
money.parse
Parse "£1,234.50" or "1.234,50 €" into integer minor units, strictly: no guessing, no rounding.
parse_money in Rust
1.0.0
py rs ts
37 tests
energy.gas-kwh
Convert gas meter units (cubic metres or hundreds of cubic feet) to kWh with the calorific value and 1.02264 correction.
gas_kwh in Rust
1.0.0
py rs ts
16 tests
retail.sku-generate
Build a deterministic stock-keeping unit code from a prefix and product attributes.
generate_sku in Rust
1.0.0
py rs ts
15 tests
subscriptions.ltv-cac
Customer lifetime value, LTV to CAC ratio and CAC payback months from ARPA, gross margin, churn and CAC.
ltv_cac in Rust
1.0.0
py rs ts
14 tests
legal.time-billing Unreviewed
Fees from time entries: each rounded to 6-minute (or other) units and priced at the fee earner's hourly rate.
time_billing in Rust
1.0.1
py rs ts
15 tests
logistics.sscc
Build an 18-digit SSCC pallet label number from extension digit, GS1 company prefix and serial, with its check digit.
build_sscc in Rust
1.1.0
py rs ts
16 tests
agri.growing-degree-days
Growing degree days (thermal time) from daily min/max temperatures, a base and an optional upper cap.
growing_degree_days in Rust
1.0.0
py rs ts
18 tests
money.amount
A currency-tagged monetary amount held in integer minor units.
money in Rust
1.0.2
py rs ts
17 tests
inventory.eoq
Economic order quantity (Harris/Wilson): the order size that minimises ordering plus holding cost, in whole units.
economic_order_quantity in Rust
1.0.0
py rs ts
20 tests
property.service-charge-apportion Unreviewed
Apportion a service charge across units by lease fraction, floor area or fixed percentage, exact to the penny.
apportion_service_charge in Rust
1.0.1
py rs ts
19 tests
finance.compound-interest
Compound interest accrued period by period in minor units, the way a statement is built.
compound_interest in Rust
1.0.0
py rs ts
18 tests
health.dose-weight-based Unreviewed
Weight-based dose (per kg) capped at a maximum single dose and rounded to a measurable volume, in exact micro-units.
weight_based_dose in Rust
1.0.1
py rs ts
20 tests
energy.meter-advance
Units consumed between two meter reads, counting the meter rolling over past all nines once.
meter_advance in Rust
1.0.0
py rs ts
13 tests
agri.yield-per-hectare
Crop yield per hectare and per acre from harvested quantity and field area in any area unit, exactly, as decimal text.
yield_per_hectare in Rust
1.0.1
py rs ts
19 tests
manufacturing.batch-size
Economic batch quantity: the EOQ for a batch made at a finite production rate, in whole units.
economic_batch_quantity in Rust
1.0.0
py rs ts
20 tests
money.format
Render a monetary amount as text, using the currency's real minor-unit precision.
format_money in Rust
1.0.0
py rs ts
11 tests
1.0.0
py rs ts
9 tests
finance.credit-note.calculate
Credit note against an original invoice, by units or by amount, with VAT at the original tax point's rates.
calculate_credit_note in Rust
1.0.0
py rs ts
21 tests
manufacturing.yield-scrap
Whole units to start for a required good output at a process yield, and the scrap that allows for.
input_for_yield in Rust
1.0.0
py rs ts
15 tests
inventory.reorder-point
Reorder point: demand over the supplier lead time, rounded up to whole units, plus safety stock.
reorder_point in Rust
1.0.0
py rs ts
13 tests
manufacturing.bom-cost
Rolled-up standard cost of one unit of a product from its BOM, bought-in costs, and labour and overhead rates.
bom_cost in Rust
1.0.0
py rs ts
15 tests
inventory.safety-stock
Safety stock in whole units, by service level and demand variability (z-score) or by max-minus-average.
safety_stock in Rust
1.0.0
py rs ts
22 tests
hospitality.recipe-scale
Scale a recipe to a new number of portions, tidying metric units (g to kg, mL to L) and rounding to kitchen precision.
scale_recipe in Rust
1.0.1
py rs ts
26 tests
money.allocate
Split an amount across ratios without losing or inventing a single minor unit.
allocate in Rust
1.0.1
py rs ts
17 tests
invest.rebalance Unreviewed
Whole-unit buy and sell trades that bring a portfolio back to target weights, skipping trades below a minimum size.
rebalance in Rust
1.0.1
py rs ts
22 tests
invest.fee-drag Unreviewed
What an annual charge costs an investment over the years: value with and without the fee, year by year, in minor units.
fee_drag in Rust
1.0.1
py rs ts
20 tests
invest.dividend-yield Unreviewed
Trailing and forward dividend yield of a share or fund, in basis points, from the price and the dividends per unit.
dividend_yield in Rust
1.0.1
py rs ts
19 tests
math.basis-points
Convert a rate between percent, basis points and a plain ratio exactly, as decimal text or integer basis points.
A group of 3: convert_rate, to_basis_points, from_basis_points
2.0.0
py rs ts
45 tests
energy.tariff-time-of-use
Cost half-hourly consumption against time-of-use rates: Economy 7 windows or Agile-style half-hourly prices.
time_of_use_cost in Rust
1.0.1
py rs ts
24 tests
manufacturing.oee
Overall equipment effectiveness (availability x performance x quality) in basis points, from times and counts.
overall_equipment_effectiveness in Rust
1.0.0
py rs ts
18 tests
monitor.format-duration
A number of seconds as a short human duration for dashboards and alerts: "3h 12m", "2d 4h", "45s".
format_duration in Rust
1.0.0
py rs ts
18 tests
energy.degree-days
Heating and cooling degree days from daily mean temperatures and a base temperature, exact to 0.1.
degree_days in Rust
1.0.0
py rs ts
14 tests
money.split-even
Split an amount into n near-equal parts that add back up to exactly the whole.
split_even in Rust
1.0.0
py rs ts
13 tests
subscriptions.usage-tiered
Price metered usage against tiers, graduated or volume, with an optional flat fee per tier.
price_usage in Rust
1.0.0
py rs ts
25 tests
fleet.emissions
Vehicle greenhouse gas emissions (grams CO2e) from fuel used or distance, using UK government DESNZ conversion factors.
fleet_emissions in Rust
1.0.1
py rs ts
23 tests
fleet.vehicle-depreciation
A vehicle's current value from its cost, age and mileage, on retention curves the caller supplies, exactly.
vehicle_depreciation in Rust
1.0.0
py rs ts
20 tests
form.character-count
The GOV.UK character count message for a text box: characters or words left or over a limit, with a threshold.
character_count in Rust
1.0.1
py rs ts
32 tests
manufacturing.takt-time
Takt time: available production time divided by customer demand, exact and in whole seconds.
takt_time in Rust
1.0.0
py rs ts
14 tests
inventory.stock-turnover
Stock turnover ratio, days inventory outstanding and days of cover for a period, computed exactly.
stock_turnover in Rust
1.0.0
py rs ts
13 tests
math.exp
e to the power x from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
exp in Rust
1.0.1
py rs ts
10 tests
agri.gross-margin
Enterprise gross margin (output less variable costs), in total and per hectare or per head, in exact money.
gross_margin in Rust
1.0.0
py rs ts
14 tests
fleet.ev-charging-cost
Cost of an electric vehicle charge from the energy added, charger efficiency and power, and time-of-use tariff windows.
ev_charging_cost in Rust
1.0.0
py rs ts
24 tests
fleet.fuel-cost
Fuel cost of a trip from distance, fuel economy (UK or US mpg, or L/100km) and price per litre, exactly.
fuel_cost in Rust
1.0.0
py rs ts
24 tests
hospitality.recipe-cost
Cost a recipe and each portion from ingredient quantities, pack sizes and pack prices, allowing for trim and waste.
recipe_cost in Rust
1.0.1
py rs ts
25 tests
inventory.abc-classification
ABC classes by annual consumption value (Pareto), with configurable cut-offs such as 80/15/5 and deterministic ties.
abc_classification in Rust
1.0.0
py rs ts
17 tests
money.convert
Convert an amount to another currency at a supplied exact rate, with an explicit rounding mode.
convert_money in Rust
1.0.0
py rs ts
19 tests
telecoms.call-rating
Rate a call from a rate deck: longest-prefix destination match, billing increments, connection fee and minimum charge.
rate_call in Rust
1.0.1
py rs ts
22 tests
charity.donation-matching
Employer match on a donation: a ratio in basis points, limited by a per-donor cap and a programme budget.
donation_match in Rust
1.0.0
py rs ts
17 tests
charts.format
Axis and label text for charts: tick numbers, SI prefixes (1.2k, 3.4M), percentages, dates and money.
A group of 5: format_tick, format_si, format_percent, format_date, format_money_tick
1.0.0
py rs ts
61 tests
energy.carbon-emissions
kgCO2e from kWh or litres of a fuel, using the UK government GHG conversion factors for the year.
carbon_emissions in Rust
1.0.1
py rs ts
17 tests
energy.estimate-read
Estimate a meter read for a date from the average daily consumption between two earlier reads, with rollover.
estimate_read in Rust
1.0.0
py rs ts
17 tests
fleet.cost-per-mile
Whole-life cost per mile of a vehicle, in tenths of a penny, from depreciation, fuel, maintenance, insurance and tax.
cost_per_mile in Rust
1.0.0
py rs ts
13 tests
inventory.expiry-fefo
First-expiry-first-out pick list for a quantity across batches, skipping expired and short-dated stock.
fefo_pick in Rust
1.0.0
py rs ts
15 tests
manufacturing.bom-explode
Explode a multi-level bill of materials into exact total quantities per component, with scrap and cycle checks.
explode_bom in Rust
1.0.0
py rs ts
17 tests
manufacturing.variance
Standard costing variances: material price and usage, labour rate and efficiency, favourable or adverse.
cost_variances in Rust
1.0.0
py rs ts
15 tests
agri.milk-price
Milk price per litre and payment from a contract's base price, butterfat/protein adjustments and bonuses.
milk_price in Rust
1.0.0
py rs ts
18 tests
charity.fundraising-ratio
Cost to raise £1 and charitable spend ratio for a charity, in exact basis points.
fundraising_ratios in Rust
1.0.0
py rs ts
12 tests
energy.bill-calculate
Electricity or gas bill from two meter reads: energy, standing charge, Climate Change Levy and VAT.
calculate_energy_bill in Rust
1.0.0
py rs ts
15 tests
inventory.valuation-fifo
FIFO stock valuation and cost of sales from a stock movement ledger, in exact money.
fifo_valuation in Rust
1.0.0
py rs ts
18 tests
inventory.valuation-weighted-average
Perpetual weighted average cost: stock value and cost of sales from a movement ledger, rounding once per issue.
weighted_average_valuation in Rust
1.0.0
py rs ts
17 tests
stats.weighted-average
Weighted average of integers, computed exactly and rounded once to stated decimals with an explicit rounding mode.
weighted_average in Rust
1.0.0
py rs ts
21 tests
telecoms.data-allowance
Mobile data allowance used and remaining, and the overage charge in whole blocks with an optional spend cap.
data_allowance in Rust
1.0.0
py rs ts
18 tests
energy.climate-change-levy
Climate Change Levy on a business supply of electricity, gas, LPG or solid fuel, at the main rate in force on the date.
climate_change_levy in Rust
1.0.2
py rs ts
20 tests
finance.markup-price
Selling price from a cost and a target margin or markup in basis points, with explicit rounding.
markup_price in Rust
1.0.0
py rs ts
21 tests
math.atan
Arctangent in radians from + - * / only (fdlibm's method), so every language returns the same double.
atan in Rust
1.0.1
py rs ts
22 tests
math.ln
Natural logarithm from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
ln in Rust
1.0.1
py rs ts
11 tests
retail.refund-calculate
Refund for returned items, sharing basket discounts back across the sale so every refund is exact to the penny.
calculate_refund in Rust
1.0.0
py rs ts
16 tests
math.percent-change
Percentage change from one value to another, in basis points, with an explicit rounding mode.
percent_change in Rust
1.0.0
py rs ts
19 tests
text.number-to-words
Write a money amount in words for a cheque: "one thousand two hundred and thirty-four pounds and fifty-six pence".
amount_in_words in Rust
1.0.0
py rs ts
16 tests
insurance.sum-insured-average Unreviewed
Average clause settlement for underinsurance: the loss times sum insured over value at risk, capped at the loss.
average_clause_settlement in Rust
1.0.1
py rs ts
22 tests
insurance.rating-factors Unreviewed
Premium from a base rate times factor-table lookups, loadings and discounts, within minimum and maximum premiums.
rate_premium in Rust
1.0.1
py rs ts
24 tests
lending.early-settlement Unreviewed
Early settlement figure and rebate on UK regulated consumer credit, per the Early Settlement Regulations 2004.
early_settlement in Rust
1.0.1
py rs ts
18 tests
lending.loan-payment Unreviewed
Level repayment for a loan (annuity formula), computed exactly and rounded once, the way you choose.
loan_payment in Rust
1.0.1
py rs ts
23 tests
agri.spray-mix Unreviewed
Sprayer tank mix: tank fills, and product and water per full and part tank, for an area, water volume and dose.
spray_mix in Rust
1.0.1
py rs ts
14 tests
insurance.premium-proration Unreviewed
Return premium on mid-term cancellation, pro rata or on a short-period scale, with an optional minimum retained premium.
cancellation_return_premium in Rust
1.0.1
py rs ts
26 tests
invest.portfolio-weights Unreviewed
Each holding's share of a portfolio and its drift from a target weight, in basis points, from exact arithmetic.
portfolio_weights in Rust
1.0.1
py rs ts
19 tests
invest.time-weighted-return Unreviewed
Time-weighted return from valuations taken at each external cash flow, geometrically linked exactly.
time_weighted_return in Rust
1.0.1
py rs ts
22 tests
property.floor-area Unreviewed
Floor area from room lengths and widths, exactly, with the total in both square metres and square feet.
floor_area in Rust
1.0.2
py rs ts
20 tests
health.egfr Unreviewed
eGFR in mL/min/1.73 m² by the race-free CKD-EPI 2021 creatinine equation, from creatinine in µmol/L or mg/dL.
egfr_ckd_epi2021 in Rust
1.0.1
py rs ts
25 tests
logistics.duty-estimate Unreviewed
Estimate import duty and import VAT on goods: customs value on a CIF basis, the caller's duty rate, VAT on top.
duty_estimate in Rust
1.0.1
py rs ts
17 tests
lending.daily-interest Unreviewed
Interest accrued day by day on a changing balance under a day-count convention, summed exactly and rounded once.
daily_interest in Rust
1.0.1
py rs ts
21 tests
property.rent-review Unreviewed
New rent after an index-linked (CPI/RPI) rent review, with an optional collar and cap and upward-only option.
rent_review in Rust
1.0.1
py rs ts
19 tests
logistics.freight-rate
Freight charge from a carrier's dated weight-break tariff for a zone, with the fuel surcharge in force on the ship date.
freight_rate in Rust
1.0.1
py rs ts
26 tests
math.rational
Exact fraction arithmetic, always reduced, for rates and ratios that must not drift.
A group of 8: calculate_rational, rational, add_rational, subtract_rational, multiply_rational, divide_rational, compare_rational, rational_to_integer
2.0.0
py rs ts
86 tests
agri.fertiliser-application
Fertiliser product rate (kg/ha and total) to meet N, P2O5 and K2O targets from its analysis, limiting nutrient first.
fertiliser_application in Rust
1.0.0
py rs ts
16 tests
banking.overdraft-interest
Overdraft interest for a statement period from daily balances, with an interest-free buffer.
overdraft_interest in Rust
1.0.0
py rs ts
15 tests
charts.stack
Stack several series for stacked bars and areas: on zero, normalised to 100%, or diverging around zero.
stack in Rust
1.0.0
py rs ts
14 tests
monitor.series-window
The samples of a time series from one moment up to (not including) another, checking they are in time order.
series_window in Rust
1.0.0
py rs ts
12 tests
retail.promotion-apply
Apply BOGOF, 3-for-2, percent off, amount off and multibuy deals to a basket, best for the customer, allocated to lines.
apply_promotions in Rust
1.0.0
py rs ts
23 tests
validation.uk-company-number
Check a Companies House company number's format and prefix (SC, NI, OC, LP...) and zero-pad it to eight characters.
validate_uk_company_number in Rust
2.0.1
py rs ts
18 tests
energy.water-bill
Metered water and sewerage bill from two reads: volumetric charges, return to sewer, standing and surface water charges.
water_bill in Rust
1.0.0
py rs ts
14 tests
finance.invoice.calculate
Calculate a complete invoice: line nets, VAT per line, totals and a VAT summary grouped by rate.
calculate_invoice in Rust
1.0.1
py rs ts
15 tests
hospitality.gross-profit-menu
Menu gross profit (GP%) on the VAT-exclusive price, and the menu price that reaches a target GP.
A group of 2: menu_gross_profit, menu_price_for_gp
1.0.0
py rs ts
20 tests