There is no inbuilt support for xoring floating point numbers. Instead you have to implement one using the struct
module
>>> from struct import pack, unpack
>>> def xor_float(f1, f2):
f1 = int(''.join(hex(ord(e))[2:] for e in struct.pack('d',f1)),16)
f2 = int(''.join(hex(ord(e))[2:] for e in struct.pack('d',f2)),16)
xor = f1 ^ f2
xor = "{:016x}".format(xor)
xor = ''.join(chr(int(xor[i:i+2],16)) for i in range(0,len(xor),2))
return struct.unpack('d',xor)[0]
>>> xor_float(10.25,10.25)
0.0
>>> xor_float(10.25,0.00)
10.25
Note This example assumes, that the floating point number is a 64 bit float, as natively supported by Python
I should have seen your pseudo-code before jumping in to solving this problem. The caret ^
in the pseudo-code is power rather than xor and in python raising a number to power (including float) is done through **
or math.pow