Skip to the calculator
Rule Calculator

2122 is 37 digits long, and an ordinary calculator gets the first 15 of them right before it starts inventing the rest. 100! runs to 158 digits. Both are exact here because the arithmetic is done in integers rather than in floating point, and the digit where a double stops being true is marked.

Big number calculator

Exact arithmetic on integers of any size, with the answer an ordinary calculator gives printed beside it and the digit where it stops being true marked in red. Powers, factorials, products, division with a remainder.

Checked by test against known exact values · How we check

37 digits

5,316,911,983,139,663,491,615,228,241,121,378,304

About 5.3169 × 10^36.

What an ordinary calculator shows

5316911983139664000000000000000000000

The first 15 digits are right. The rest are not digits of this number at all. The arithmetic was fine here — the value fits a double exactly — and the display is what went wrong: a double carries about seventeen significant digits, so anything printed past that is padding.

This site had the bug too

Until this page existed, the exponent calculator here answered 2122 with 5,316,911,983,139,664,000,000,000,000,000,000,000. The true value is 5,316,911,983,139,663,491,615,228,241,121,378,304 — the same for sixteen digits and then twenty digits of nothing.

What makes it worth a page rather than a footnote is that the arithmetic was correct. Powers of two survive a double intact however large they get. The formatter is what failed: it carries seventeen significant digits and fills the rest with zeros, and zeros look like an answer. Every calculator on this site now switches to scientific notation past that point rather than writing out digits it cannot vouch for.

Where a double stops

2^53 = 9,007,199,254,740,992
The last integer a double holds with certainty. Every whole number below it is exact.
~17 significant digits
What the formatter can print truthfully. Beyond it the digits are padding.
100! has 158 digits
A double gives up long before: 22! is the last factorial it holds exactly, because its odd part still fits in 53 bits.
No limit here
BigInt is arbitrary precision. The only cap on this page is how many digits are worth printing.

Questions people actually ask

Is there a factorial calculator here?
This is one — pick factorial as the operation. It is exact at any size, which ordinary calculators are not: a double holds 22! exactly and loses digits from 23! onwards, and 100! has 158 digits, all of which are printed here. The trailing zeros are countable too: 100! ends in 24 of them, one for every factor of five in the product.
Why does my calculator get big numbers wrong?
Because it stores them as doubles — 64-bit floating point — which hold integers exactly only up to 2^53, about 9 quadrillion. Past that a number is kept as the nearest value the format can represent, and the display pads the missing digits with zeros. Nothing warns you, because from the machine’s point of view nothing went wrong.
Is 2^122 wrong because of the arithmetic or the display?
The display. Powers of two are exact in a double however large, so the value was right and the printing was not: the formatter carries about seventeen significant digits and manufactures the rest. 3^80 is the other case — there the arithmetic itself drifts, and the wrong number exists before anything is printed.
What is the largest number this handles?
There is no fixed limit; the arithmetic is arbitrary precision. The cap here is on printing — around 20,000 digits — because past that the page becomes a wall of digits rather than an answer. 1000! is 2,568 digits and computes instantly.
Why does division give a remainder instead of decimals?
Because this is integer arithmetic. 100 ÷ 7 has no exact decimal expansion, so returning 14.285714285714286 would be the same rounding this page exists to avoid. 14 remainder 2 is exactly true, and the repeating decimal is a different question with its own page.
Where does the 2^53 limit come from?
A double spends 52 bits on the significand plus one implied bit, which is 53 bits of integer precision — every whole number up to 9,007,199,254,740,992 and none reliably above it. It is a property of IEEE 754, so every language using doubles has the same ceiling: JavaScript, Python floats, spreadsheets.

Sources

Related

Did this answer your question?