Decimal Precision Calculator
Exact base-10 arithmetic backed by BigInt scaled integers, with five rounding modes and a live IEEE 754 floating-point comparison.
Operands & Rounding
Exact Decimal Result
IEEE 754 64-bit Float Comparison (A + B)
Shows what JavaScript Number(A) + Number(B) computes in 64-bit binary floating point versus exact base-10 addition.
| Exact decimal A + B | 0.3 |
|---|---|
| JavaScript Number(A) + Number(B) | 0.30000000000000004 |
| Matches exact decimal? | No: binary rounding error present |
| Nearest IEEE 754 double to A | |
| Nearest IEEE 754 double to B | |
| Exact stored double of (A + B) |
About This Tool
Standard JavaScript numbers use 64-bit IEEE 754 binary floating point, which cannot represent base-10 fractions like 0.1 or 0.2 exactly. Adding 0.1 and 0.2 in binary floating point produces 0.30000000000000004. Financial calculations, tax rounding, and unit pricing need exact base-10 arithmetic.
This calculator parses every input into a BigInt scaled integer (int / 10^scale) up to 1,000 decimal places. Addition, subtraction, and multiplication are computed with zero intermediate rounding, then rounded to your target scale using the rounding mode you select. A side-by-side IEEE 754 inspector shows the exact base-10 expansion of the nearest 64-bit float.
Key Features
- BigInt scaled decimal engine: Stores numbers as exact base-10 integers and scales up to 1,000 decimal places with no binary float conversion.
- Five rounding modes: Half-up, Half-even (banker's rounding), Floor, Ceiling, and Truncate.
- Exact and rounded output: View both the unrounded exact result (for add, subtract, multiply) and the rounded result at your chosen decimal scale.
- IEEE 754 float comparison: Inspect what a 64-bit binary float actually stores in memory and why 0.1 + 0.2 does not equal 0.3.
- Thousands grouping toggle: Format large numbers with comma separators for readability while copying either raw or grouped output.