Arbitrary-Precision Decimal Arithmetic in JavaScript
· 3 min read
Binary floating-point values cannot represent many decimal fractions exactly. This is why expressions such as 0.1 + 0.2 do not produce an exact decimal 0.3. Financial, accounting, tax, pricing, and measurement code often needs decimal arithmetic with explicit precision and rounding.