Calculation methodology

This page documents the technical decisions behind every result.

Numeric precision

Rounding

Type Rule Example
Mathematical (default) Half away from zero 2.345 → 2.35; −2.5 → −3
Currency (money amounts) To cents, half up 10.005 → 10.01
Banker’s (available in the library) Half to even 2.345 → 2.34; 2.355 → 2.36

Rounding works on the decimal representation, so 1.005 rounds to 1.01 as you would expect. You can choose 0–6 decimals in each calculator; money is always shown with 2.

Conventions

Undefined cases

We never show “NaN” or “Infinity”. We distinguish division by zero (a non-zero amount divided by zero), indeterminate forms (zero divided by zero) and out-of-range inputs (such as a discount above 100%), and explain which value to change.

Reading numbers

Calculators accept the usual formats: decimal point or comma, thousands separators (“1,234.56”, “1.234,56”, “1 234,56”), the typographic minus sign and a trailing % sign. If an input such as “1,500” could be read two ways, it is interpreted according to the page language (in English, one thousand five hundred) and the interpretation is shown under the field.

Verification

The maths library has well over a hundred automated tests covering positive and negative values, zeros, decimals, percentages above 100, reverse percentages, chained changes, rounding and number parsing in every site language. Worked examples are computed with the same library at build time.