calc
Perform exact arithmetic, percentages, statistics, and conversions with high precision, returning citeable results for verification.
Instructions
Exact arithmetic. Never do arithmetic in your head: call this, even for "simple" sums.
Write Python-like syntax: + - * / // % ** (or ^), parentheses, comparisons.
Functions: sqrt cbrt root(x, n) exp ln log(x, base) log10 log2, trig, floor
ceil round(x, n) abs, min max sum mean median (numbers or one list),
factorial binomial gcd lcm mod, isprime nextprime factorint (alone), and
percentages: pct(15, 2347) = 15% of 2347, pct_change(old, new) = % change,
ratio(a, b). Constants: pi e tau inf. Numbers are exact: 0.1 + 0.2 = 3/10.
Examples: "pct(21, 1250)", "(1.05^10 - 1) * 100", "mean([3, 5, 8])".
Returns {id, cite, exact, decimal (text, precision significant digits),
is_exact (true when decimal is the exact value), latex}. No variables: use
math for x, y. Cite the number as its cite, e.g. [L-000042].
Keywords: calculate, compute, how much is, percentage, percent of, discount, VAT, interest, average, square root, factorial, is prime, calcular, cuánto es, cuánto son, porcentaje, tanto por ciento, descuento, IVA, interés, media, raíz cuadrada, factorial, es primo.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| precision | No | ||
| expression | Yes |