1# Test behaviour of inf and nan in basic float operations 2 3inf = float("inf") 4nan = float("nan") 5 6values = (-2, -1, 0, 1, 2, inf, nan) 7 8for x in values: 9 for y in values: 10 print(x, y) 11 print(" + - *", x + y, x - y, x * y) 12 try: 13 print(" /", x / y) 14 except ZeroDivisionError: 15 print(" / ZeroDivisionError") 16 try: 17 print(" ** pow", x ** y, pow(x, y)) 18 except ZeroDivisionError: 19 print(" ** pow ZeroDivisionError") 20 print(" == != < <= > >=", x == y, x != y, x < y, x <= y, x > y, x >= y) 21