Functional Weave
Code in Python

Results for “math”

100 capabilities

math.pow
base to the power exponent from + - * / only, exact by squaring for whole exponents, identical in every language.
pow in Python
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
math.atan
Arctangent in radians from + - * / only (fdlibm's method), so every language returns the same double.
atan in Python
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
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
math.ln
Natural logarithm from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
ln in Python
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
math.sin-cos
Sine and cosine of an angle in radians from + - * / only, so every language returns the same doubles.
sin_cos in Python
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
math.clamp
Clamp an integer to an inclusive range, refusing a range whose bounds are the wrong way round.
clamp in Python
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
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
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
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
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
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
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
auth.recovery-codes
Two-factor recovery codes: generate from caller entropy, hash for storage, and verify-and-consume as a pure step.
A group of 4: generate_recovery_codes, normalise_recovery_code, hash_recovery_code, consume_recovery_code
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
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
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
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
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
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
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
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
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
form.money-input
Read a typed amount as minor units for its currency and locale, check min/max, and format it back.
A group of 3: parse_money_input, format_money_input, money_input_format