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 does trigger an exception show how the exception is caught. |
|||
⚫ | |||
⚫ | |||
:* It should be explicitly noted when an integer overflow is not recognized, the program continues with wrong results. |
|||
⚫ | |||
⚫ | |||
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. |
:* It is okay to mention, when a language supports unlimited precision integers, but this task is NOT the place to demonstrate the <br> capabilities of unlimited precision integers. |
||
<br><br> |
<br><br> |
||