Hi,
I'm having some problem using the function "xor" to get xor value of 2 bit strings. The strings that i am using are:
1001100010111111010010000000010010110001110110100100110001101001
and
1000001100111111011010110101000100100001101001111100110010100110
and I am getting the wrong result as
1001100010111111010010000000010010110001110110100100110001101001
whereas it should be
0001101110000000001000110101010110010000011111011000000011001111
Any ideas as to why this happens and what is the way to work around this?
Any help would be greatly appreciated.
Thanks.
xor function
Moderator: General Moderators
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
xor function
You're right. I thought of writing a function but was just wondering why such a simple function was giving incorrect results, in php and if there was a readymade workaround!!
But, I guess I'll have to write my own function now.
Thanks!!
But, I guess I'll have to write my own function now.
Thanks!!
Looking through the manual, I'm pretty sure that it happens because PHP will only work with 32-bit or less numbers accurately. you should check out the GMP Library Reference at http://www.php.net/manual/en/ref.gmp.php. This will allow you arbitrary precision.[/url]