Canonical: https://toolipedia.app/floating-point-error-calculator

# Floating point error calculator

Enter numbers and an operation to see the stored double value, its exact decimal expansion, the rounding error and the exact result, plus how repeated sums drift.

Breadcrumbs: Toolipedia > Developer tools > Code and developer utilities > Floating point error calculator

## About Floating point error calculator

Computers store most decimal fractions as the nearest 64-bit binary double, so 0.1 is really 0.1000000000000000055511151231257827 and 0.1 + 0.2 comes out as 0.30000000000000004. This calculator reads your decimals exactly, shows the stored double of each, performs the operation as JavaScript does, and compares it with the exact decimal result using integer arithmetic. It reports the error in decimal and in units of the last place, checks the result against the number you expected, and adds a number to itself many times to show how errors accumulate.

## How to use Floating point error calculator
1. Type numbers A and B as decimals and choose addition, subtraction, multiplication or division.
2. Optionally type the result you expected, such as 0.3, to see why it is not equal.
3. Set how many times A is added to itself to watch the error build up.

## Why use this tool?
- Private: everything happens in your browser. Nothing you enter is uploaded.
- Free, with no sign-up, no watermark and no limit on how often you use it.
- Works on phones, tablets and computers: Android, iPhone, Windows, Mac and Linux. Nothing to install.

## Also known as
- floating point error calculator
- why 0.1 + 0.2 is not 0.3
- double precision rounding error
- exact decimal value of a double
- floating point drift sum

## Frequently asked questions

### Why is 0.1 + 0.2 not exactly 0.3?

Neither 0.1 nor 0.2 has an exact binary form. Their stored doubles are slightly above the decimals, and the sum rounds to a double one step above the double nearest 0.3.

### What is a unit in the last place?

It is the gap between a double and the next larger one at that size. An error of 0.8 ulp means the result is off by eight tenths of that gap, which is typical of a single rounding.

### How do I avoid these errors with money?

Store amounts as whole cents in integers or use a decimal number type. Compare floating-point results with a small tolerance instead of using exact equality.

### Is Floating point error calculator free?

Yes. Floating point error calculator on Toolipedia is free to use, with no sign-up and no watermark.

### Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

### Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

### Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

## Related tools

More free tools that go well with Floating point error calculator:
- [IEEE 754 Floating Point Converter](https://toolipedia.app/ieee754-converter)
- [Half Precision, bfloat16 and Fixed-Point Converter](https://toolipedia.app/half-precision-bfloat16-and-fixed-point-converter)
- [JSON formatter & validator](https://toolipedia.app/json-formatter)
- [Coming Soon, Maintenance and Error Page Generator](https://toolipedia.app/coming-soon-maintenance-and-error-page-generator)
- [Gitignore and Glob Pattern Tester](https://toolipedia.app/gitignore-and-glob-pattern-tester)
