Overflow Exception


overflow is instruction exception that is triggered by the ALU via a status flag when the arithmetic operation does not have enough space to be performed.


If a programmer incorrectly:

  • declares a variable as int (16 bit integer) that has a maximum storage value of <math>2^{15}−1</math>
  • try to store a bigger value in this variable, the cpu will fail with an overflow failure.

That variable should have been declared with a bigger data type such as long, which has at least 32 bits on any computer.

Powered by ComboStrap