Comment
Comment by strenholme
The thing about the “Use XOR to swap two variables” trick is that it’s a version of this solution which works for any two real numbers (or integers):
XOR is simply addition or subtraction modulo 2 for each bit, so making the above XOR looks like this: