This calculator does exact arithmetic on integers of any size — far beyond the floating-point limit where ordinary calculators silently lose precision. It uses JavaScript’s BigInt, so a 200-digit multiplication is correct to the last digit.
How it works
Each operand is parsed as a BigInt and the chosen operation is applied with exact integer semantics:
add a + b
subtract a - b
multiply a × b
divide quotient = a / b (truncated), remainder = a % b
modulo a % b
power a ^ b (b ≥ 0)
Division and modulo follow BigInt’s truncated rule: the quotient rounds toward zero and the remainder takes the sign of the dividend. Division or modulo by zero is rejected rather than producing a meaningless result.
Example and tips
Multiplying two 30-digit numbers gives a precise 59- or 60-digit product that a
float-based calculator would mangle. For 17 ÷ 5, you get quotient 3 and
remainder 2. If you need modular exponentiation specifically, the dedicated
modular-exponentiation tool is far faster for large exponents because it reduces
modulo m at every step.
Why floating-point silently loses precision
A standard JavaScript number (and most calculator applications) uses IEEE 754 double-precision floating-point. This format stores a 53-bit significand, which means integers are represented exactly only up to 2^53 − 1, or 9,007,199,254,740,991 — roughly 9 quadrillion. Any integer larger than that is rounded to the nearest representable value.
The rounding is silent. If you multiply two 10-digit numbers in a regular calculator and the result is a 20-digit number, you may get a result that looks plausible but is wrong in the last several digits. For financial ledgers, cryptographic computations, or combinatorial problems this is a serious error.
BigInt stores each integer exactly as a sequence of digits, with no inherent size limit. Operations are slower than float arithmetic — BigInt multiplication of two 1,000-digit numbers takes milliseconds rather than nanoseconds — but the result is always exact.
Worked examples
Factorial and combinatorics
Factorials grow very quickly. For example, 20! = 2,432,902,008,176,640,000 — this is just within the safe integer range for float. But 21! = 51,090,942,171,709,440,000 already exceeds 2^53 and will be rounded by a standard calculator. With this tool, both are exact.
Checking divisibility of large numbers
To check whether a large number is divisible by another, use division and inspect the remainder. For example, dividing a large candidate number by 7 and getting a remainder of 0 confirms divisibility exactly, with no risk of rounding introducing a false remainder.
Cryptographic key arithmetic
RSA and similar public-key systems operate on integers that are typically hundreds of digits long — 2048-bit RSA keys are about 617 decimal digits. Manual verification of a modular arithmetic step (before using the dedicated modulo-exponentiation tool for the full fast computation) can be done here with exact results.
Division behaviour and edge cases
The division operation returns two values: the integer quotient (truncated toward zero) and the remainder. This is consistent with how most programming languages implement integer division:
17 ÷ 5→ quotient3, remainder2(because 3 × 5 + 2 = 17)-17 ÷ 5→ quotient-3, remainder-2(remainder carries the sign of the dividend)17 ÷ -5→ quotient-3, remainder2
Dividing by zero is rejected outright. Taking a modulo where the divisor is zero is likewise rejected.