Why ordinary calculators round big numbers
Most calculators and spreadsheets store numbers as 64-bit floating point, which keeps only about 15 to 17 significant digits. The largest whole number they can hold exactly is 9,007,199,254,740,991 (2⁵³ − 1). Past that, digits are silently lost: a spreadsheet shows 2⁶⁴ as 1.84467E+19, and many programs print 18446744073709552000 instead of the exact 18,446,744,073,709,551,616.
This calculator works on the digits themselves, using your browser's arbitrary-precision integers (BigInt). Decimals are stored as a whole number plus a count of decimal places, so 0.1 + 0.2 is exactly 0.3.
How each operation works
a mod b = a − b × floor(a ÷ b)
n! = n × (n − 1) × … × 2 × 1
- Divide gives the whole-number quotient and remainder for whole numbers, and the decimal answer to up to 1,000 places, rounded half up at the last place.
- Power takes whole-number exponents. Negative exponents give 1 ÷ aⁿ as a decimal.
- Mod follows the math convention: the remainder has the same sign as b, so −7 mod 3 = 2. The truncated remainder used by C and JavaScript (−1) is shown when it differs.
- Factorial goes up to 10,000!, which has 35,660 digits.
Worked examples
- 2²⁵⁶ = 115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,936 (78 digits). That's the number of possible 256-bit keys.
- 100! has 158 digits. It starts 93326215443944152681… and ends in 24 zeros.
- 1 ÷ 7 to 30 places = 0.142857142857142857142857142857.
Limits
- Inputs up to 10,000 digits each; powers up to 100,000 digits of output; factorials up to 10,000!. These caps keep the page from freezing on a phone.
- Mod, factorial and GCD need whole numbers.
- Square roots and other irrational results aren't exact in any finite number of digits; use the square root calculator for those.