Scientific notation converter

To and from scientific notation, both ways — and then the part nobody shows you: the exact value your machine is really holding, every digit of it. Type 0.1 and see what you get. Nothing you type here leaves your browser — it is worked out on your own device, so there is nothing to send and nothing to log.

What your machine is actually holding

A computer stores numbers in binary, and a tenth is not a sum of powers of two any more than a third is a sum of powers of ten. So when you type 0.1, what is stored is the nearest number it can hold, which is:

0.1000000000000000055511151231257827021181583404541015625

That is not an approximation of the stored value. That is the stored value, exactly, all 55 digits of it. Every double is an exact rational number — a whole number times a power of two — and every one of those has a terminating decimal, so the full expansion can be written out rather than estimated. This page writes it out.

Which is why 0.1 + 0.2 is not 0.3. The two stored values add to 0.3000000000000000444089209850062616169452667236328125, and 0.3 is stored as 0.29999999999999998889776975374843459576368331909179 6875. Different numbers, so the comparison is false, and it is not a bug in anything.

Halves are fine. Type 0.5 or 0.25 and the expansion is exactly what you typed, because those are sums of powers of two. The rule is not "decimals are inexact" — it is that a decimal survives only if its fractional part is made of halves.

Where whole numbers stop

A double has 53 bits of significand, so above 253 — 9,007,199,254,740,991 — there is no longer room for every whole number. At 1017 the gap between one representable number and the next is 16: fifteen of every sixteen integers in that range simply do not exist, and asking for one gives you a neighbour without comment.

This page tells you the gap at whatever size you enter, and whether consecutive whole numbers still exist there. It is the number to check before storing an identifier, a timestamp in nanoseconds, or a currency amount in the smallest unit.

Where to go next