2016-01-31 06:35:58 +03:00
|
|
|
# test + +
|
|
|
|
|
2015-03-15 00:20:58 +03:00
|
|
|
print(0 ^ (1 << 80))
|
|
|
|
print((1 << 80) ^ (1 << 80))
|
|
|
|
print((1 << 80) ^ 0)
|
|
|
|
|
|
|
|
a = 0xfffffffffffffffffffffffffffff
|
|
|
|
print(a ^ (1 << 100))
|
|
|
|
print(a ^ (1 << 200))
|
2015-11-22 23:02:15 +03:00
|
|
|
print(a ^ a == 0)
|
2015-11-22 23:11:01 +03:00
|
|
|
print(bool(a ^ a))
|
2016-01-31 06:35:58 +03:00
|
|
|
|
|
|
|
# test - +
|
|
|
|
|
|
|
|
print((-1 << 80) ^ (1 << 80))
|
|
|
|
print((-1 << 80) ^ 0)
|
|
|
|
|
|
|
|
print((-a) ^ (1 << 100))
|
|
|
|
print((-a) ^ (1 << 200))
|
|
|
|
print((-a) ^ a == 0)
|
|
|
|
print(bool((-a) ^ a))
|
2016-12-19 05:13:10 +03:00
|
|
|
print(-1 ^ 0xffffffffffffffff) # carry overflows to higher digit
|
2016-01-31 06:35:58 +03:00
|
|
|
|
|
|
|
# test + -
|
|
|
|
|
|
|
|
print(0 ^ (-1 << 80))
|
|
|
|
print((1 << 80) ^ (-1 << 80))
|
|
|
|
|
|
|
|
print(a ^ (-1 << 100))
|
|
|
|
print(a ^ (-1 << 200))
|
|
|
|
print(a ^ (-a) == 0)
|
|
|
|
print(bool(a ^ (-a)))
|
|
|
|
|
|
|
|
# test - -
|
|
|
|
|
|
|
|
print((-1 << 80) ^ (-1 << 80))
|
|
|
|
|
|
|
|
print((-a) ^ (-1 << 100))
|
|
|
|
print((-a) ^ (-1 << 200))
|
|
|
|
print((-a) ^ (-a) == 0)
|
|
|
|
print(bool((-a) ^ (-a)))
|