RosettaCodeData/Task/Integer-overflow/True-BASIC/integer-overflow.basic

14 lines
455 B
Plaintext

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