Calculator

Basic calculator with keyboard support

 
0

A note on floating-point math

This calculator evaluates expressions using JavaScript's standard IEEE 754 double-precision floating-point arithmetic β€” the same format used by virtually every modern programming language and processor.

Floating-point can produce surprising results: 0.1 + 0.2 in JavaScript gives 0.30000000000000004, not 0.3. This is not a bug β€” it's a fundamental limitation of representing decimal fractions in binary. Base-10 fractions like 0.1 can't be expressed exactly in base-2, just like 1/3 can't be written exactly in base-10 decimal.

For everyday calculations the error is negligible (it's in the 15th–16th decimal place). For financial or precision-critical work, use a dedicated decimal library that avoids binary floating-point entirely.