gmqcc/tests/xor.qc

25 lines
467 B
C++
Raw Normal View History

2013-06-15 09:48:40 +00:00
void main() {
float x = 5;
float y = 3;
float z = x ^ y; // 6
float a = 2;
float b = 10;
float c = a ^ b; // 8
print(ftos(z), "\n");
print(ftos(c), "\n");
2013-06-15 11:05:25 +00:00
// commutative?
if (x ^ y == y ^ x)
print("commutative\n");
// assocative?
if (x ^ (y ^ z) == (x ^ y) ^ z)
print("assocative\n");
// elements are their own inverse?
if (x ^ 0 == x)
print("inverse\n");
2013-06-15 09:48:40 +00:00
}