Number Too Big (Error 6)
Sinclair ZX Spectrum
Severity: MinorWhat it means
Error 6 — Number Too Big — means a calculation produced a result larger than the Spectrum's maximum number (approximately 1.7 × 10^38).
This almost always means a division by zero or a runaway loop.
Affected Models
- ZX Spectrum 16K
- ZX Spectrum 48K
- ZX Spectrum+
- ZX Spectrum 128K
- ZX Spectrum +2
- ZX Spectrum +3
Common Causes
- Division by zero (produces infinity, which triggers Error 6)
- Exponential calculation growing without bound
- Loop multiplying a value without a stopping condition
- LOG or EXP of extreme values
How to Fix It
-
Check for division by zero.
If your code does LET X = A / B, check that B can never be 0.
Add: IF B = 0 THEN ... before the division. -
Check EXP and power operations.
EXP(100) is already larger than 10^38.
Any large exponent will overflow.
Ensure your exponents stay in a reasonable range. -
Add range checks to loop variables.
If a loop multiplies a variable each iteration (LET X = X * 2), it will overflow very quickly.
Add a limit check: IF X > 1E30 THEN STOP
Frequently Asked Questions
What is the largest number a ZX Spectrum can handle?
The Spectrum uses 5-byte floating point, giving a range of approximately 1.7 × 10^38.
For integers, the Spectrum uses 16-bit integers (in some contexts), giving a range of -65535 to 65535.
Exceeding either limit gives Number Too Big or Integer Out of Range depending on context.