Integer overflow: Difference between revisions

Content added Content deleted
m (added whitespace, indented the tables, aligned the notes.)
Line 25: Line 25:


For 32-bit signed integers:
For 32-bit signed integers:
{|class="wikitable"
::::: {|class="wikitable"
!Expression
!Expression
!Result that does not fit into a 32-bit signed integer
!Result that does not fit into a 32-bit signed integer
Line 46: Line 46:


For 64-bit signed integers:
For 64-bit signed integers:
{|class="wikitable"
::: {|class="wikitable"
!Expression
!Expression
!Result that does not fit into a 64-bit signed integer
!Result that does not fit into a 64-bit signed integer
Line 67: Line 67:


For 32-bit unsigned integers:
For 32-bit unsigned integers:
{|class="wikitable"
::::: {|class="wikitable"
!Expression
!Expression
!Result that does not fit into a 32-bit unsigned integer
!Result that does not fit into a 32-bit unsigned integer
Line 85: Line 85:


For 64-bit unsigned integers:
For 64-bit unsigned integers:
{|class="wikitable"
::: {|class="wikitable"
!Expression
!Expression
!Result that does not fit into a 64-bit unsigned integer
!Result that does not fit into a 64-bit unsigned integer
Line 102: Line 102:
|}
|}



When the integer overflow does trigger an exception show how the exception is caught.
;Notes:
When the integer overflow produces some value print it.
It should be explicitly noted when an integer overflow is not recognized and the program continues with wrong results.
:*   When the integer overflow does trigger an exception show how the exception is caught.
:*   When the integer overflow produces some value,   print it.
This should be done for signed and unsigned integers of various sizes supported by the language.
:*   It should be explicitly noted when an integer overflow is not recognized,   the program continues with wrong results.
When a language has no fixed size integer type or when no integer overflow can occur
:*   This should be done for signed and unsigned integers of various sizes supported by the computer programming language.
for other reasons this should be noted.
:*   When a language has no fixed size integer type,   or when no integer overflow can occur for other reasons,   this should be noted.
It is okay to mention, when a language supports unlimited precision integers, but
this task is NOT the place to demonstrate the capabilities of unlimited precision integers.
:* &nbsp; It is okay to mention, &nbsp; when a language supports unlimited precision integers, &nbsp; but this task is NOT the place to demonstrate the <br>&nbsp; capabilities of unlimited precision integers.
<br><br>
<br><br>