math.pow
base to the power exponent from + - * / only, exact by squaring for whole exponents, identical in every language.
pow in Python
1.0.0
py rs ts
16 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 Python
1.0.1
py rs ts
10 tests
math.atan
Arctangent in radians from + - * / only (fdlibm's method), so every language returns the same double.
atan in Python
1.0.1
py rs ts
22 tests
math.fractional-power
Raise a positive decimal to a fractional power, (1.199)^(31/365), identically in every language.
fractional_power in Python
1.0.0
py rs ts
19 tests
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.
round_div_big in Python
1.0.0
py rs ts
21 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
math.percent-change
Percentage change from one value to another, in basis points, with an explicit rounding mode.
percent_change in Python
1.0.0
py rs ts
19 tests
math.ln
Natural logarithm from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
ln in Python
1.0.1
py rs ts
11 tests
math.big-integer
Exact integer arithmetic of any size, on decimal strings, for powers and products that overflow 64 bits.
calculate_big_integer in Python
1.0.0
py rs ts
24 tests
math.sin-cos
Sine and cosine of an angle in radians from + - * / only, so every language returns the same doubles.
sin_cos in Python
1.0.1
py rs ts
10 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
math.clamp
Clamp an integer to an inclusive range, refusing a range whose bounds are the wrong way round.
clamp in Python
1.0.0
py rs ts
12 tests
math.round-float
Round a float half away from zero to 0-12 decimal places, identically in TypeScript, Python and Rust.
round_float in Python
1.0.0
py rs ts
22 tests
math.integer-sqrt
Exact integer square root: the largest whole number whose square does not exceed n.
integer_sqrt in Python
1.0.0
py rs ts
11 tests
math.round-div
Integer division with an explicit rounding mode, for money arithmetic that must not drift.
round_div in Python
1.0.0
py rs ts
14 tests
math.gcd-lcm
Greatest common divisor and least common multiple of two integers, exactly and without overflow.
A group of 3: gcd_lcm, gcd, lcm
2.0.0
py rs ts
39 tests
charts.layout
Chart layout: the plot area inside margins, legend items wrapped into rows, and greedy label collision avoidance.
A group of 3: plot_area, legend_rows, avoid_collisions
1.0.1
py rs ts
33 tests
text.format-decimal
Format a float as plain decimal text with fixed or trimmed places and optional grouping, identically in every language.
format_decimal in Python
1.0.0
py rs ts
19 tests
dates.day-count-fraction
Year fraction between two dates by ACT/365F, ACT/360, 30/360, 30E/360 or ACT/ACT ISDA, as an exact fraction.
day_count_fraction in Python
1.0.0
py rs ts
21 tests
stats.weighted-average
Weighted average of integers, computed exactly and rounded once to stated decimals with an explicit rounding mode.
weighted_average in Python
1.0.0
py rs ts
21 tests
finance.markup-price
Selling price from a cost and a target margin or markup in basis points, with explicit rounding.
markup_price in Python
1.0.0
py rs ts
21 tests
construction.materials-area
Packs of tiles, paint, plasterboard or flooring to cover an area, with waste and coats, rounded up to whole packs.
materials_area in Python
1.0.0
py rs ts
18 tests
charts.shape
SVG path strings for lines, areas, steps, monotone curves, bars, arcs and pie slices, identical in every language.
A group of 7: line_path, area_path, step_path, monotone_curve, bar_rects, arc_path, pie_angles
1.0.1
py rs ts
70 tests
charts.axis
Axis geometry as data: tick positions, tick marks, label anchors and gridlines for number, time and category axes.
A group of 5: axis_from_ticks, number_axis, time_axis, band_axis, grid_lines
1.0.1
py rs ts
49 tests
agri.field-area
Field area in square metres, hectares and acres from a boundary polygon of latitude/longitude points.
field_area in Python
1.0.0
py rs ts
14 tests
health.bsa Unreviewed
Body surface area in m² by the Mosteller and the DuBois & DuBois formulas, to 2 decimal places.
body_surface_area in Python
1.0.1
py rs ts
16 tests
construction.roof-pitch
Roof pitch in degrees, rafter length and roof slope area from span, rise and length.
roof_pitch in Python
1.0.0
py rs ts
15 tests
geo.distance
Great-circle distance in metres between two latitude/longitude points (haversine), to the millimetre.
distance in Python
2.0.0
py rs ts
21 tests
charts.ticks
Axis ticks: a round step (1, 2 or 5 x 10^k), the ticks on it, and calendar ticks from days to years.
A group of 4: tick_step, nice_ticks, time_tick_interval, time_ticks
1.0.0
py rs ts
57 tests
net.latency-summary
Summarise probe results: sent, received, loss, min/avg/max, p95 and jitter, in whole microseconds.
summarise_latency in Python
1.0.0
py rs ts
16 tests
agri.feed-ration
Ration costing and dry matter intake from each feed's fresh weight, DM % and price per tonne, in exact money.
feed_ration in Python
1.0.0
py rs ts
15 tests
charts.extent
The minimum and maximum of a series as [min, max], skipping gaps (null), or null when there is no value.
extent in Python
1.0.1
py rs ts
15 tests
charts.scale
Map data values onto screen positions and back: linear, log, time, band and point scales, and nice domains.
A group of 7: linear_scale, invert_linear, nice_domain, log_scale, time_scale, band_scale, point_scale
1.1.0
py rs ts
93 tests
subscriptions.mrr-arr
Monthly and annual recurring revenue from a list of subscriptions, normalising intervals and leaving out trials.
mrr_arr in Python
1.1.0
py rs ts
19 tests
stats.percentile
Percentile of a list of numbers by a named method: nearest-rank, or linear interpolation (R-7, Excel PERCENTILE.INC).
percentile in Python
2.0.0
py rs ts
29 tests
charts.color
Hex colours to RGB and back, and sRGB channels to linear light and back, identically in every language.
A group of 4: parse_hex, to_hex, srgb_to_linear, linear_to_srgb
1.0.1
py rs ts
39 tests
money.compare
Compare two amounts of one currency, refusing to compare across currencies; min, max and clamp too.
A group of 4: compare_money, min_money, max_money, clamp_money
2.0.0
py rs ts
39 tests
stats.moving-average
Simple or exponential moving average over a series, one value per full window, rounded to stated decimals.
moving_average in Python
2.0.0
py rs ts
24 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 Python
1.0.0
py rs ts
14 tests
charts.histogram-bins
Bin values into histogram bins on round edges, by Sturges' rule, Freedman-Diaconis, or a fixed width.
histogram_bins in Python
1.0.0
py rs ts
17 tests
charts.interpolate-color
The colour at a point along a sequential or diverging ramp, mixed in OKLab so steps look even; hex in, hex out.
interpolate_color in Python
1.0.0
py rs ts
19 tests
charts.stack
Stack several series for stacked bars and areas: on zero, normalised to 100%, or diverging around zero.
stack in Python
1.0.0
py rs ts
14 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 Python
1.0.0
py rs ts
24 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 Python
1.0.0
py rs ts
20 tests
inventory.reorder-point
Reorder point: demand over the supplier lead time, rounded up to whole units, plus safety stock.
reorder_point in Python
1.0.0
py rs ts
13 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 Python
1.0.0
py rs ts
20 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 Python
1.0.0
py rs ts
15 tests
money.convert
Convert an amount to another currency at a supplied exact rate, with an explicit rounding mode.
convert_money in Python
1.0.0
py rs ts
19 tests
monitor.burn-rate
How fast an SLO's error budget is burning: the error rate as a multiple of the rate the SLO allows, in thousandths.
burn_rate in Python
1.0.0
py rs ts
17 tests
monitor.error-budget
How much of an SLO's error budget is allowed, used and left, from good and bad event counts or seconds.
error_budget in Python
1.0.0
py rs ts
19 tests
monitor.rollup
Aggregate a metric series into fixed time buckets (count, min, max, avg, sum, last), empty buckets included.
rollup in Python
1.0.0
py rs ts
15 tests
monitor.status-code-summary
Count HTTP status codes by class (1xx to 5xx) and give the server error and client error rates in basis points.
summarise_status_codes in Python
1.0.0
py rs ts
12 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 Python
1.0.1
py rs ts
22 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 Python
1.0.0
py rs ts
18 tests
agri.seed-rate
Seed rate in kg/ha from target plants per m², thousand-grain weight and expected establishment.
seed_rate in Python
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
construction.concrete-volume
Concrete for slabs, strip footings, pads and round columns: volume to the litre and an order rounded up to 0.1 m³.
concrete_volume in Python
1.0.0
py rs ts
19 tests
dates.add-days
Shift an ISO date by a whole number of days, forwards or backwards, with exact calendar arithmetic.
add_days in Python
1.0.0
py rs ts
28 tests
inventory.eoq
Economic order quantity (Harris/Wilson): the order size that minimises ordering plus holding cost, in whole units.
economic_order_quantity in Python
1.0.0
py rs ts
20 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 Python
1.0.0
py rs ts
17 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 Python
1.0.0
py rs ts
17 tests
retail.price-rounding
Snap a price to a price point: charm pricing (.99, .95), nearest 5p or 10p, rounding up, down or to nearest.
round_price in Python
1.0.0
py rs ts
25 tests
banking.savings-aer
AER (annual equivalent rate) from a gross nominal rate and how often interest is paid, to two decimal places.
savings_aer in Python
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 Python
1.0.0
py rs ts
13 tests
stats.standard-deviation
Population or sample standard deviation of a list of numbers, two-pass, rounded to stated decimals.
standard_deviation in Python
2.0.0
py rs ts
21 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 Python
1.0.0
py rs ts
18 tests
geo.bounding-box
Latitude/longitude bounding box that contains every point within a distance of a centre point.
bounding_box in Python
2.0.0
py rs ts
15 tests
manufacturing.capacity
Capacity against routed load per work centre over a period, with efficiency, utilisation and overload flags.
work_centre_load in Python
1.0.0
py rs ts
14 tests
todo.summary
Counts for a todo list's header or footer: total, active, done, overdue, due today, percent done and "3 items left".
summarise_todos in Python
1.0.0
py rs ts
13 tests
subscriptions.proration
Mid-cycle plan change: credit for unused time on the old plan and charge for the rest of the period on the new one.
prorate_change in Python
1.0.0
py rs ts
17 tests
payroll.overtime Unreviewed
Pay for the time worked in a period split into multiplier bands: basic, time and a half after 40 hours, double time.
overtime_pay in Python
1.0.1
py rs ts
11 tests
health.bmi Unreviewed
Adult body mass index (kg/m², 1 decimal place) and its NICE/WHO weight category.
bmi in Python
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 Python
1.0.1
py rs ts
24 tests
invest.cagr Unreviewed
Compound annual growth rate between two values over a whole or fractional number of years, in basis points.
cagr in Python
1.0.1
py rs ts
22 tests
lending.early-settlement Unreviewed
Early settlement figure and rebate on UK regulated consumer credit, per the Early Settlement Regulations 2004.
early_settlement in Python
1.0.1
py rs ts
18 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 Python
1.0.1
py rs ts
19 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 Python
1.0.1
py rs ts
25 tests
insurance.loss-ratio Unreviewed
Loss ratio, expense ratio and combined ratio in basis points, from earned premium, incurred claims and expenses.
loss_ratios in Python
1.0.1
py rs ts
12 tests
invest.bond-yield Unreviewed
Current yield and yield to maturity of a fixed-coupon bond from its clean price, as Excel's YIELD defines it.
bond_yield in Python
1.0.2
py rs ts
27 tests
lending.apr Unreviewed
Consumer-credit APR from drawdowns and repayments, by the FCA CONC App 1.2.6 equation, to one decimal place.
apr in Python
1.0.1
py rs ts
22 tests
lending.loan-payment Unreviewed
Level repayment for a loan (annuity formula), computed exactly and rounded once, the way you choose.
loan_payment in Python
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 Python
1.0.1
py rs ts
14 tests
invest.time-weighted-return Unreviewed
Time-weighted return from valuations taken at each external cash flow, geometrically linked exactly.
time_weighted_return in Python
1.0.1
py rs ts
22 tests
payroll.pro-rata-salary Unreviewed
Salary for part of a pay period and for part-time hours, by calendar days or working days, rounded once.
pro_rata_salary in Python
1.0.1
py rs ts
13 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 Python
1.0.1
py rs ts
21 tests
invest.money-weighted-return Unreviewed
Money-weighted return (XIRR) of dated cash flows on Excel's actual/365 convention, solved exactly in fixed point.
money_weighted_return in Python
1.0.1
py rs ts
24 tests
lending.ltv Unreviewed
Loan-to-value ratio in basis points, and the band it falls in from a band table you supply.
loan_to_value in Python
1.0.1
py rs ts
17 tests
money.add
Add, subtract and negate monetary amounts, refusing to mix currencies.
add_money in Python
1.0.1
py rs ts
12 tests
education.gpa
Grade point average on a 4.0 scale from letter grades and credit hours, weighted by credits and rounded once.
gpa in Python
1.0.0
py rs ts
22 tests
text.integer-to-words
Spell out a whole number in British English words, with "and" the way a cheque writes it.
integer_to_words in Python
1.0.0
py rs ts
25 tests
education.weighted-grade
Weighted percentage across coursework and exam components, exact as a fraction, then rounded once.
weighted_grade in Python
1.0.0
py rs ts
22 tests
money.amount
A currency-tagged monetary amount held in integer minor units.
money in Python
1.0.2
py rs ts
17 tests
money.apply-rate
Apply a rate expressed in basis points to a monetary amount, with an explicit rounding mode.
apply_rate in Python
1.0.1
py rs ts
22 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 Python
1.0.0
py rs ts
16 tests
education.fee-instalments
Tuition fee instalment schedule from a total, shares and due dates, exact to the penny.
fee_instalments in Python
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 Python
1.0.0
py rs ts
11 tests
finance.margin
Profit on a sale with both the margin and the markup, so the two are never confused.
margin in Python
1.0.0
py rs ts
13 tests
finance.invoice.calculate
Calculate a complete invoice: line nets, VAT per line, totals and a VAT summary grouped by rate.
calculate_invoice in Python
1.0.1
py rs ts
15 tests
energy.meter-advance
Units consumed between two meter reads, counting the meter rolling over past all nines once.
meter_advance in Python
1.0.0
py rs ts
13 tests
charts.line-chart
Complete line chart geometry as data: plot area, number or date axes, gridlines, series paths, colours, legend.
line_chart in Python
1.0.0
py rs ts
11 tests