Integer overflow: Difference between revisions
Content added Content deleted
m (→{{header|Perl}}: added </lang> to match the <lang c> [??]) |
(Integer overflow in True BASIC) |
||
Line 2,512: | Line 2,512: | ||
puts [expr { clamp32(2000000000 + 2000000000) }]; # ==> 1852516352</lang> |
puts [expr { clamp32(2000000000 + 2000000000) }]; # ==> 1852516352</lang> |
||
Tcl 8.4 used a mix of 32-bit and 64-bit numbers on 32-bit platforms and 64-bit numbers only on 64-bit platforms. Users are recommended to upgrade to avoid this complexity. |
Tcl 8.4 used a mix of 32-bit and 64-bit numbers on 32-bit platforms and 64-bit numbers only on 64-bit platforms. Users are recommended to upgrade to avoid this complexity. |
||
=={{header|True BASIC}}== |
|||
<lang qbasic>PRINT "Signed 32-bit:" |
|||
PRINT -(-2147483647-1) !-2147483648 |
|||
PRINT 2000000000 + 2000000000 !4000000000 |
|||
PRINT -2147483647 - 2147483647 !-4294967294 |
|||
PRINT 46341 * 46341 !2147488281 |
|||
!PRINT (-2147483647-1) / -1 !error: Illegal expression |
|||
WHEN ERROR IN |
|||
PRINT maxnum * 2 !Run-time error "Overflow" |
|||
USE |
|||
PRINT maxnum |
|||
!returns the largest number that can be represented in your computer |
|||
END WHEN |
|||
END</lang> |
|||
=={{header|VBScript}}== |
=={{header|VBScript}}== |