Ad Space — Top Banner

Overflow

Sharp Sharp MZ

Severity: Minor

What Does This Error Mean?

Overflow means a calculation produced a number too large for BASIC to handle. The numeric limit depends on which BASIC you have loaded — typically around 1.7 x 10^38. Reduce the scale of your calculations or break them into smaller steps.

Affected Models

  • Sharp MZ-80K
  • Sharp MZ-80A
  • Sharp MZ-80B
  • Sharp MZ-700
  • Sharp MZ-800
  • EmuZ emulator

Common Causes

  • Multiplication or exponentiation producing an extremely large number
  • Runaway loop that keeps multiplying a variable
  • Division by a very small number producing a very large result
  • Factorial or exponential calculation exceeding the numeric range

How to Fix It

  1. Identify which calculation is causing the overflow.

    Add PRINT statements before the failing line to see the variable values. Find which one is growing beyond the limit.

  2. Break large calculations into smaller steps.

    Computing A = B * C first, then D = A * E, can sometimes avoid overflow in intermediate results.

  3. Use logarithms for very large numbers.

    LOG() converts to logarithmic scale where multiplication becomes addition. This avoids overflow for very large calculations.

Frequently Asked Questions

Does the overflow limit vary between Sharp MZ BASIC versions?

Slightly. Different BASICs (SP-5025, HuBASIC, S-BASIC) may use different floating-point implementations. But the practical limit is always around 1.7 x 10^38 for single precision.

What happens with numbers that are too small (underflow)?

Numbers smaller than the minimum representable value are silently rounded to zero. Unlike overflow, underflow does not produce an error message.