How to XOR two doubles in JAVA?
simple '^' doesn't work for doubles... Would I have to convert a double to binary form and do it bitwise? or is there any other way?
If you mean to do this bitwise you need to use the Double utility functions to get long representations and then convert back to a double at the end:
Double
long
double c = Double.longBitsToDouble( Double.doubleToRawLongBits(a) ^ Double.doubleToRawLongBits(b));
2.1m questions
2.1m answers
60 comments
57.0k users