Lichen

tests/numbers.py

336:8c75cdf1a764
2016-12-06 Paul Boddie Introduced stream classes employing C-level FILE pointers, changing the sys stdin, stdout and stderr objects to be instances of these stream classes. Added fread and fwrite support to the native functions. Added support for raising EOFError.
     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     11 j = -2 ** 30    12 print j                                 # -1073741824    13     14 print i + j                             # 0    15     16 try:    17     print i - j    18 except OverflowError:    19     print "i - j: overflow occurred"    20     21 print i / i                             # 1    22 print i / j                             # -1    23 print j / j                             # 1    24 print j / i                             # -1    25     26 try:    27     print i * j    28 except OverflowError:    29     print "i * j: overflow occurred"    30     31 print i - i                             # 0    32 print j - j                             # 0    33 print ~j                                # 1073741823    34 print i & ~j                            # 0    35 print i - 1 & ~j                        # 1073741823