Lichen

tests/numbers.py

434:224da90acd50
2017-01-07 Paul Boddie Added GC_INIT portability call.
     1 import sys     2      3 print sys.maxint     4 print sys.minint     5      6 print sys.maxint + sys.minint     7      8 i = 2 ** 30     9 print i                                 # 1073741824    10 print hex(i)                            # 0x40000000    11 print oct(i)                            # 010000000000    12     13 j = -2 ** 30    14 print j                                 # -1073741824    15 print hex(j)                            # -0x40000000    16 print oct(j)                            # -010000000000    17     18 print i + j                             # 0    19     20 try:    21     print i - j    22 except OverflowError:    23     print "i - j: overflow occurred"    24     25 print i / i                             # 1    26 print i / j                             # -1    27 print j / j                             # 1    28 print j / i                             # -1    29     30 try:    31     print i * j    32 except OverflowError:    33     print "i * j: overflow occurred"    34     35 print i - i                             # 0    36 print j - j                             # 0    37 print ~j                                # 1073741823    38 print i & ~j                            # 0    39 print i - 1 & ~j                        # 1073741823    40     41 print hex(31)                           # 0x1f    42 print oct(31)                           # 037