Bitcoin Forum
November 05, 2024, 11:08:40 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3] 4 5 »  All
  Print  
Author Topic: This message was too old and has been purged  (Read 6043 times)
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1137

All paid signature campaigns should be banned.


View Profile WWW
January 23, 2014, 04:29:27 PM
 #41

Why on Earth do you have a mod 2^32-1 and not mod 2^32?

The result of mod 2^32-1 (on an integer) gives you results from 0x00000000 to 0xFFFFFFFE

Seems pretty worthless.  Are you SURE that is the correct formula for the allowed mod operator?

Please double check this because your description of what the allowed mod operator does:

"chop off the bits above 32 bits"

would indicate that the allowed operator is really mod 2^32.

mod 2^32-1 does not "chop off all the bits above 32 bits".

Scaling by 2^32-1 would work (as shown above) but what a total PITA.

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
OP_CHECKSIG
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
January 23, 2014, 04:35:34 PM
 #42

I'm with BurtW on this.  BTW.. way more than $200 worth of effort in this thread already  Shocked
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1137

All paid signature campaigns should be banned.


View Profile WWW
January 23, 2014, 04:37:33 PM
 #43

I love puzzles and work is slow right now.  Speaking of work, got a meeting, be back later.

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
Evil-Knievel (OP)
Legendary
*
Offline Offline

Activity: 1260
Merit: 1168



View Profile
January 23, 2014, 07:38:09 PM
Last edit: April 17, 2016, 09:21:00 PM by Evil-Knievel
 #44

This message was too old and has been purged
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1137

All paid signature campaigns should be banned.


View Profile WWW
January 23, 2014, 07:54:07 PM
 #45

Hmmm.  The method I described would require you to use the mod 2^32 thirty-two times and it does not simplify as you suggested (the mod cannot be pulled out of the formula).  It also requires you to use integer math, not floating point, or figure out a way to throw away the fractional part of all the divides.

If you add mod 2^32 and use integer math (or throw away the fractional parts of the divides) then you have a solution, otherwise no.

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1036



View Profile WWW
January 24, 2014, 03:13:09 AM
 #46

Hi! Well, the 232-1 is needed for one purpose.
Let us keep it simple: In order to rorate a 8 bitfield (lets say x) once to the left, you would do the following operation: x*2 mod (28-1)

Lets quickly verify:
10010110 = 150

Bitrotation to the left:
00101101 = 45

Now doublecheck with math operator:
150*2 mod (28 -1) = 45   WORKS LIKE A CHARM!

Now what we want it is in the 32bit case the following (very simplified case):
x = x xor LEFT_ROTATE(y)

As the modulo operator is pretty costly I would want to apply it only once! Meaning ... performing all the calculations, and afterwards doing once the "mod 232-1".
This is perfectly legit, as the modulo operator is completely associative  [e.g.  (a mod n) + (b mod n) = (a+b) mod n  - as well as - (a * b) mod n = (a mod n) * (b mod n)  ] Smiley
Modulo is not costly. In some cases, it can be faster in CPU than instructions to store data.
XOR is bitwise arithmetic mod 2, it will take 3 mod operations per bit outside of that needed to shuffle things around. I will only adapt your silly mod to into mod 2, which I have already written.
minerpeabody
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
January 25, 2014, 05:47:34 AM
 #47

If it is not too late, I would like to offer a possible solution.

Basically, it uses the following formula to implement a single bit XOR:

xor (1 bit)=  0^(0^(a+b) + 0^(2-(a+b)))

I implement modulus using the following formula:

mod= 0^(1+(-1)^(N/(2^bit_position)))

It makes use of the fact that -1 to an even power yields 1, while -1 to an odd power yields -1... adding this output to 1, gives values of 0 and 2.  Raising 0 to either 0 or 2 yields 1 or 0, thus when n is even, the result is 0, and when n is odd, the result is 1... basically the same result as N mod 2.

This program is written in Perl and uses the int() function which is the same thing as the floor function.  It can be omitted entirely if done using integer math.  If this doesn't work for you, I might be able to code around it.  Anyway, here goes:

#!/usr/bin/perl

$buf= <STDIN>;
my ($a, $b)= split /\s/, $buf;

$result= 0**(0**(0**(1+(-1)**int($a))+0**(1+(-1)**int($b)))+0**(2-(0**(1+(-1)**int($a))+0**(1+(-1)**int($b)))))+
0**(0**(0**(1+(-1)**int($a/2))+0**(1+(-1)**int($b/2)))+0**(2-(0**(1+(-1)**int($a/2))+0**(1+(-1)**int($b/2)))))*2+
0**(0**(0**(1+(-1)**int($a/4))+0**(1+(-1)**int($b/4)))+0**(2-(0**(1+(-1)**int($a/4))+0**(1+(-1)**int($b/4)))))*4+
0**(0**(0**(1+(-1)**int($a/8))+0**(1+(-1)**int($b/8)))+0**(2-(0**(1+(-1)**int($a/8))+0**(1+(-1)**int($b/8)))))*8+
0**(0**(0**(1+(-1)**int($a/16))+0**(1+(-1)**int($b/16)))+0**(2-(0**(1+(-1)**int($a/16))+0**(1+(-1)**int($b/16)))))*16+
0**(0**(0**(1+(-1)**int($a/32))+0**(1+(-1)**int($b/32)))+0**(2-(0**(1+(-1)**int($a/32))+0**(1+(-1)**int($b/32)))))*32+
0**(0**(0**(1+(-1)**int($a/64))+0**(1+(-1)**int($b/64)))+0**(2-(0**(1+(-1)**int($a/64))+0**(1+(-1)**int($b/64)))))*64+
0**(0**(0**(1+(-1)**int($a/128))+0**(1+(-1)**int($b/128)))+0**(2-(0**(1+(-1)**int($a/128))+0**(1+(-1)**int($b/128)))))*128+
0**(0**(0**(1+(-1)**int($a/256))+0**(1+(-1)**int($b/256)))+0**(2-(0**(1+(-1)**int($a/256))+0**(1+(-1)**int($b/256)))))*256+
0**(0**(0**(1+(-1)**int($a/512))+0**(1+(-1)**int($b/512)))+0**(2-(0**(1+(-1)**int($a/512))+0**(1+(-1)**int($b/512)))))*512+
0**(0**(0**(1+(-1)**int($a/1024))+0**(1+(-1)**int($b/1024)))+0**(2-(0**(1+(-1)**int($a/1024))+0**(1+(-1)**int($b/1024)))))*1024+
0**(0**(0**(1+(-1)**int($a/2048))+0**(1+(-1)**int($b/2048)))+0**(2-(0**(1+(-1)**int($a/2048))+0**(1+(-1)**int($b/2048)))))*2048+
0**(0**(0**(1+(-1)**int($a/4096))+0**(1+(-1)**int($b/4096)))+0**(2-(0**(1+(-1)**int($a/4096))+0**(1+(-1)**int($b/4096)))))*4096+
0**(0**(0**(1+(-1)**int($a/8192))+0**(1+(-1)**int($b/8192)))+0**(2-(0**(1+(-1)**int($a/8192))+0**(1+(-1)**int($b/8192)))))*8192+
0**(0**(0**(1+(-1)**int($a/16384))+0**(1+(-1)**int($b/16384)))+0**(2-(0**(1+(-1)**int($a/16384))+0**(1+(-1)**int($b/16384)))))*16384+
0**(0**(0**(1+(-1)**int($a/32768))+0**(1+(-1)**int($b/32768)))+0**(2-(0**(1+(-1)**int($a/32768))+0**(1+(-1)**int($b/32768)))))*32768+
0**(0**(0**(1+(-1)**int($a/65536))+0**(1+(-1)**int($b/65536)))+0**(2-(0**(1+(-1)**int($a/65536))+0**(1+(-1)**int($b/65536)))))*65536+
0**(0**(0**(1+(-1)**int($a/131072))+0**(1+(-1)**int($b/131072)))+0**(2-(0**(1+(-1)**int($a/131072))+0**(1+(-1)**int($b/131072)))))*131072+
0**(0**(0**(1+(-1)**int($a/262144))+0**(1+(-1)**int($b/262144)))+0**(2-(0**(1+(-1)**int($a/262144))+0**(1+(-1)**int($b/262144)))))*262144+
0**(0**(0**(1+(-1)**int($a/524288))+0**(1+(-1)**int($b/524288)))+0**(2-(0**(1+(-1)**int($a/524288))+0**(1+(-1)**int($b/524288)))))*524288+
0**(0**(0**(1+(-1)**int($a/1048576))+0**(1+(-1)**int($b/1048576)))+0**(2-(0**(1+(-1)**int($a/1048576))+0**(1+(-1)**int($b/1048576)))))*1048576+
0**(0**(0**(1+(-1)**int($a/2097152))+0**(1+(-1)**int($b/2097152)))+0**(2-(0**(1+(-1)**int($a/2097152))+0**(1+(-1)**int($b/2097152)))))*2097152+
0**(0**(0**(1+(-1)**int($a/4194304))+0**(1+(-1)**int($b/4194304)))+0**(2-(0**(1+(-1)**int($a/4194304))+0**(1+(-1)**int($b/4194304)))))*4194304+
0**(0**(0**(1+(-1)**int($a/8388608))+0**(1+(-1)**int($b/8388608)))+0**(2-(0**(1+(-1)**int($a/8388608))+0**(1+(-1)**int($b/8388608)))))*8388608+
0**(0**(0**(1+(-1)**int($a/16777216))+0**(1+(-1)**int($b/16777216)))+0**(2-(0**(1+(-1)**int($a/16777216))+0**(1+(-1)**int($b/16777216)))))*16777216+
0**(0**(0**(1+(-1)**int($a/33554432))+0**(1+(-1)**int($b/33554432)))+0**(2-(0**(1+(-1)**int($a/33554432))+0**(1+(-1)**int($b/33554432)))))*33554432+
0**(0**(0**(1+(-1)**int($a/67108864))+0**(1+(-1)**int($b/67108864)))+0**(2-(0**(1+(-1)**int($a/67108864))+0**(1+(-1)**int($b/67108864)))))*67108864+
0**(0**(0**(1+(-1)**int($a/134217728))+0**(1+(-1)**int($b/134217728)))+0**(2-(0**(1+(-1)**int($a/134217728))+0**(1+(-1)**int($b/134217728)))))*134217728+
0**(0**(0**(1+(-1)**int($a/268435456))+0**(1+(-1)**int($b/268435456)))+0**(2-(0**(1+(-1)**int($a/268435456))+0**(1+(-1)**int($b/268435456)))))*268435456+
0**(0**(0**(1+(-1)**int($a/536870912))+0**(1+(-1)**int($b/536870912)))+0**(2-(0**(1+(-1)**int($a/536870912))+0**(1+(-1)**int($b/536870912)))))*536870912+
0**(0**(0**(1+(-1)**int($a/1073741824))+0**(1+(-1)**int($b/1073741824)))+0**(2-(0**(1+(-1)**int($a/1073741824))+0**(1+(-1)**int($b/1073741824)))))*1073741824+
0**(0**(0**(1+(-1)**int($a/2147483648))+0**(1+(-1)**int($b/2147483648)))+0**(2-(0**(1+(-1)**int($a/2147483648))+0**(1+(-1)**int($b/2147483648)))))*2147483648;

print "$result\n";

minerpeabody
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
January 26, 2014, 01:59:13 AM
Last edit: January 26, 2014, 02:53:25 AM by minerpeabody
 #48

Ok, I would like to revise my last submission then.

Realizing that your MOD 2^32-1 was essentially part of a rotate operation, it finally donned on me that my method of using the power properties of -1 would still work as a substitute modulus function which in turn would supply the bit inputs for the XOR function.  As long as I could via your rotate as described, I could set the 1's  bit, I could use even vs. odd powers of -1 as described in my previous post.

THE NEW PROGRAM:

#!/usr/bin/perl

$buf= <STDIN>;
my ($a, $b) = split /\s/, $buf;


$result= 0**(0**(0**(1+(-1)**($a*2**(32-0)%(2**32-1)))+0**(1+(-1)**($b*2**(32-0)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-0)%(2**32-1)))+0**(1+(-1)**($b*2**(32-0)%(2**32-1))))))+
0**(0**(0**(1+(-1)**($a*2**(32-1)%(2**32-1)))+0**(1+(-1)**($b*2**(32-1)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-1)%(2**32-1)))+0**(1+(-1)**($b*2**(32-1)%(2**32-1))))))*2+
0**(0**(0**(1+(-1)**($a*2**(32-2)%(2**32-1)))+0**(1+(-1)**($b*2**(32-2)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-2)%(2**32-1)))+0**(1+(-1)**($b*2**(32-2)%(2**32-1))))))*4+
0**(0**(0**(1+(-1)**($a*2**(32-3)%(2**32-1)))+0**(1+(-1)**($b*2**(32-3)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-3)%(2**32-1)))+0**(1+(-1)**($b*2**(32-3)%(2**32-1))))))*8+
0**(0**(0**(1+(-1)**($a*2**(32-4)%(2**32-1)))+0**(1+(-1)**($b*2**(32-4)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-4)%(2**32-1)))+0**(1+(-1)**($b*2**(32-4)%(2**32-1))))))*16+
0**(0**(0**(1+(-1)**($a*2**(32-5)%(2**32-1)))+0**(1+(-1)**($b*2**(32-5)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-5)%(2**32-1)))+0**(1+(-1)**($b*2**(32-5)%(2**32-1))))))*32+
0**(0**(0**(1+(-1)**($a*2**(32-6)%(2**32-1)))+0**(1+(-1)**($b*2**(32-6)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-6)%(2**32-1)))+0**(1+(-1)**($b*2**(32-6)%(2**32-1))))))*64+
0**(0**(0**(1+(-1)**($a*2**(32-7)%(2**32-1)))+0**(1+(-1)**($b*2**(32-7)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-7)%(2**32-1)))+0**(1+(-1)**($b*2**(32-7)%(2**32-1))))))*128+
0**(0**(0**(1+(-1)**($a*2**(32-8)%(2**32-1)))+0**(1+(-1)**($b*2**(32-8)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-8)%(2**32-1)))+0**(1+(-1)**($b*2**(32-8)%(2**32-1))))))*256+
0**(0**(0**(1+(-1)**($a*2**(32-9)%(2**32-1)))+0**(1+(-1)**($b*2**(32-9)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-9)%(2**32-1)))+0**(1+(-1)**($b*2**(32-9)%(2**32-1))))))*512+
0**(0**(0**(1+(-1)**($a*2**(32-10)%(2**32-1)))+0**(1+(-1)**($b*2**(32-10)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-10)%(2**32-1)))+0**(1+(-1)**($b*2**(32-10)%(2**32-1))))))*1024+
0**(0**(0**(1+(-1)**($a*2**(32-11)%(2**32-1)))+0**(1+(-1)**($b*2**(32-11)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-11)%(2**32-1)))+0**(1+(-1)**($b*2**(32-11)%(2**32-1))))))*2048+
0**(0**(0**(1+(-1)**($a*2**(32-12)%(2**32-1)))+0**(1+(-1)**($b*2**(32-12)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-12)%(2**32-1)))+0**(1+(-1)**($b*2**(32-12)%(2**32-1))))))*4096+
0**(0**(0**(1+(-1)**($a*2**(32-13)%(2**32-1)))+0**(1+(-1)**($b*2**(32-13)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-13)%(2**32-1)))+0**(1+(-1)**($b*2**(32-13)%(2**32-1))))))*8192+
0**(0**(0**(1+(-1)**($a*2**(32-14)%(2**32-1)))+0**(1+(-1)**($b*2**(32-14)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-14)%(2**32-1)))+0**(1+(-1)**($b*2**(32-14)%(2**32-1))))))*16384+
0**(0**(0**(1+(-1)**($a*2**(32-15)%(2**32-1)))+0**(1+(-1)**($b*2**(32-15)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-15)%(2**32-1)))+0**(1+(-1)**($b*2**(32-15)%(2**32-1))))))*32768+
0**(0**(0**(1+(-1)**($a*2**(32-16)%(2**32-1)))+0**(1+(-1)**($b*2**(32-16)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-16)%(2**32-1)))+0**(1+(-1)**($b*2**(32-16)%(2**32-1))))))*65536+
0**(0**(0**(1+(-1)**($a*2**(32-17)%(2**32-1)))+0**(1+(-1)**($b*2**(32-17)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-17)%(2**32-1)))+0**(1+(-1)**($b*2**(32-17)%(2**32-1))))))*131072+
0**(0**(0**(1+(-1)**($a*2**(32-18)%(2**32-1)))+0**(1+(-1)**($b*2**(32-18)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-18)%(2**32-1)))+0**(1+(-1)**($b*2**(32-18)%(2**32-1))))))*262144+
0**(0**(0**(1+(-1)**($a*2**(32-19)%(2**32-1)))+0**(1+(-1)**($b*2**(32-19)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-19)%(2**32-1)))+0**(1+(-1)**($b*2**(32-19)%(2**32-1))))))*524288+
0**(0**(0**(1+(-1)**($a*2**(32-20)%(2**32-1)))+0**(1+(-1)**($b*2**(32-20)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-20)%(2**32-1)))+0**(1+(-1)**($b*2**(32-20)%(2**32-1))))))*1048576+
0**(0**(0**(1+(-1)**($a*2**(32-21)%(2**32-1)))+0**(1+(-1)**($b*2**(32-21)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-21)%(2**32-1)))+0**(1+(-1)**($b*2**(32-21)%(2**32-1))))))*2097152+
0**(0**(0**(1+(-1)**($a*2**(32-22)%(2**32-1)))+0**(1+(-1)**($b*2**(32-22)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-22)%(2**32-1)))+0**(1+(-1)**($b*2**(32-22)%(2**32-1))))))*4194304+
0**(0**(0**(1+(-1)**($a*2**(32-23)%(2**32-1)))+0**(1+(-1)**($b*2**(32-23)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-23)%(2**32-1)))+0**(1+(-1)**($b*2**(32-23)%(2**32-1))))))*8388608+
0**(0**(0**(1+(-1)**($a*2**(32-24)%(2**32-1)))+0**(1+(-1)**($b*2**(32-24)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-24)%(2**32-1)))+0**(1+(-1)**($b*2**(32-24)%(2**32-1))))))*16777216+
0**(0**(0**(1+(-1)**($a*2**(32-25)%(2**32-1)))+0**(1+(-1)**($b*2**(32-25)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-25)%(2**32-1)))+0**(1+(-1)**($b*2**(32-25)%(2**32-1))))))*33554432+
0**(0**(0**(1+(-1)**($a*2**(32-26)%(2**32-1)))+0**(1+(-1)**($b*2**(32-26)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-26)%(2**32-1)))+0**(1+(-1)**($b*2**(32-26)%(2**32-1))))))*67108864+
0**(0**(0**(1+(-1)**($a*2**(32-27)%(2**32-1)))+0**(1+(-1)**($b*2**(32-27)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-27)%(2**32-1)))+0**(1+(-1)**($b*2**(32-27)%(2**32-1))))))*134217728+
0**(0**(0**(1+(-1)**($a*2**(32-28)%(2**32-1)))+0**(1+(-1)**($b*2**(32-28)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-28)%(2**32-1)))+0**(1+(-1)**($b*2**(32-28)%(2**32-1))))))*268435456+
0**(0**(0**(1+(-1)**($a*2**(32-29)%(2**32-1)))+0**(1+(-1)**($b*2**(32-29)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-29)%(2**32-1)))+0**(1+(-1)**($b*2**(32-29)%(2**32-1))))))*536870912+
0**(0**(0**(1+(-1)**($a*2**(32-30)%(2**32-1)))+0**(1+(-1)**($b*2**(32-30)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-30)%(2**32-1)))+0**(1+(-1)**($b*2**(32-30)%(2**32-1))))))*1073741824+
0**(0**(0**(1+(-1)**($a*2**(32-31)%(2**32-1)))+0**(1+(-1)**($b*2**(32-31)%(2**32-1))))+0**(2-(0**(1+(-1)**($a*2**(32-31)%(2**32-1)))+0**(1+(-1)**($b*2**(32-31)%(2**32-1))))))*2147483648;

print "$result\n";

Does this work for you?

MP
btcton
Legendary
*
Offline Offline

Activity: 1302
Merit: 1007


View Profile
January 26, 2014, 07:27:52 AM
 #49

I'm sorry to be that guy, but what kind if calculators do you guys have? Or are you just using Python/Perl?

The signature campaign posters adding useless redundant fluff to their posts to reach their minimum word count are lowering my IQ.
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1036



View Profile WWW
January 26, 2014, 08:22:03 AM
Last edit: January 26, 2014, 09:07:00 AM by deepceleron
 #50

Ok, I would like to revise my last submission then.

Realizing that your MOD 2^32-1 was essentially part of a rotate operation, it finally donned on me that my method of using the power properties of -1 would still work as a substitute modulus function which in turn would supply the bit inputs for the XOR function.  As long as I could via your rotate as described, I could set the 1's  bit, I could use even vs. odd powers of -1 as described in my previous post.

THE NEW PROGRAM:
...
Does this work for you?

It works for me! In Python, pretty much as written, :

def xor(a, b):
   return 0**(0**(0**(1+(-1)**(a*2**(32-0)%(2**32-1)))+0**(1+(-1)**(b*2**(32-0)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-0)%(2**32-1)))+0**(1+(-1)**(b*2**(32-0)%(2**32-1))))))+\
0**(0**(0**(1+(-1)**(a*2**(32-1)%(2**32-1)))+0**(1+(-1)**(b*2**(32-1)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-1)%(2**32-1)))+0**(1+(-1)**(b*2**(32-1)%(2**32-1))))))*2+\
0**(0**(0**(1+(-1)**(a*2**(32-2)%(2**32-1)))+0**(1+(-1)**(b*2**(32-2)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-2)%(2**32-1)))+0**(1+(-1)**(b*2**(32-2)%(2**32-1))))))*4+\
0**(0**(0**(1+(-1)**(a*2**(32-3)%(2**32-1)))+0**(1+(-1)**(b*2**(32-3)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-3)%(2**32-1)))+0**(1+(-1)**(b*2**(32-3)%(2**32-1))))))*8+\
0**(0**(0**(1+(-1)**(a*2**(32-4)%(2**32-1)))+0**(1+(-1)**(b*2**(32-4)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-4)%(2**32-1)))+0**(1+(-1)**(b*2**(32-4)%(2**32-1))))))*16+\
0**(0**(0**(1+(-1)**(a*2**(32-5)%(2**32-1)))+0**(1+(-1)**(b*2**(32-5)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-5)%(2**32-1)))+0**(1+(-1)**(b*2**(32-5)%(2**32-1))))))*32+\
0**(0**(0**(1+(-1)**(a*2**(32-6)%(2**32-1)))+0**(1+(-1)**(b*2**(32-6)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-6)%(2**32-1)))+0**(1+(-1)**(b*2**(32-6)%(2**32-1))))))*64+\
0**(0**(0**(1+(-1)**(a*2**(32-7)%(2**32-1)))+0**(1+(-1)**(b*2**(32-7)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-7)%(2**32-1)))+0**(1+(-1)**(b*2**(32-7)%(2**32-1))))))*128+\
0**(0**(0**(1+(-1)**(a*2**(32-8)%(2**32-1)))+0**(1+(-1)**(b*2**(32-8)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-8)%(2**32-1)))+0**(1+(-1)**(b*2**(32-8)%(2**32-1))))))*256+\
0**(0**(0**(1+(-1)**(a*2**(32-9)%(2**32-1)))+0**(1+(-1)**(b*2**(32-9)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-9)%(2**32-1)))+0**(1+(-1)**(b*2**(32-9)%(2**32-1))))))*512+\
0**(0**(0**(1+(-1)**(a*2**(32-10)%(2**32-1)))+0**(1+(-1)**(b*2**(32-10)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-10)%(2**32-1)))+0**(1+(-1)**(b*2**(32-10)%(2**32-1))))))*1024+\
0**(0**(0**(1+(-1)**(a*2**(32-11)%(2**32-1)))+0**(1+(-1)**(b*2**(32-11)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-11)%(2**32-1)))+0**(1+(-1)**(b*2**(32-11)%(2**32-1))))))*2048+\
0**(0**(0**(1+(-1)**(a*2**(32-12)%(2**32-1)))+0**(1+(-1)**(b*2**(32-12)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-12)%(2**32-1)))+0**(1+(-1)**(b*2**(32-12)%(2**32-1))))))*4096+\
0**(0**(0**(1+(-1)**(a*2**(32-13)%(2**32-1)))+0**(1+(-1)**(b*2**(32-13)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-13)%(2**32-1)))+0**(1+(-1)**(b*2**(32-13)%(2**32-1))))))*8192+\
0**(0**(0**(1+(-1)**(a*2**(32-14)%(2**32-1)))+0**(1+(-1)**(b*2**(32-14)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-14)%(2**32-1)))+0**(1+(-1)**(b*2**(32-14)%(2**32-1))))))*16384+\
0**(0**(0**(1+(-1)**(a*2**(32-15)%(2**32-1)))+0**(1+(-1)**(b*2**(32-15)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-15)%(2**32-1)))+0**(1+(-1)**(b*2**(32-15)%(2**32-1))))))*32768+\
0**(0**(0**(1+(-1)**(a*2**(32-16)%(2**32-1)))+0**(1+(-1)**(b*2**(32-16)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-16)%(2**32-1)))+0**(1+(-1)**(b*2**(32-16)%(2**32-1))))))*65536+\
0**(0**(0**(1+(-1)**(a*2**(32-17)%(2**32-1)))+0**(1+(-1)**(b*2**(32-17)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-17)%(2**32-1)))+0**(1+(-1)**(b*2**(32-17)%(2**32-1))))))*131072+\
0**(0**(0**(1+(-1)**(a*2**(32-18)%(2**32-1)))+0**(1+(-1)**(b*2**(32-18)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-18)%(2**32-1)))+0**(1+(-1)**(b*2**(32-18)%(2**32-1))))))*262144+\
0**(0**(0**(1+(-1)**(a*2**(32-19)%(2**32-1)))+0**(1+(-1)**(b*2**(32-19)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-19)%(2**32-1)))+0**(1+(-1)**(b*2**(32-19)%(2**32-1))))))*524288+\
0**(0**(0**(1+(-1)**(a*2**(32-20)%(2**32-1)))+0**(1+(-1)**(b*2**(32-20)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-20)%(2**32-1)))+0**(1+(-1)**(b*2**(32-20)%(2**32-1))))))*1048576+\
0**(0**(0**(1+(-1)**(a*2**(32-21)%(2**32-1)))+0**(1+(-1)**(b*2**(32-21)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-21)%(2**32-1)))+0**(1+(-1)**(b*2**(32-21)%(2**32-1))))))*2097152+\
0**(0**(0**(1+(-1)**(a*2**(32-22)%(2**32-1)))+0**(1+(-1)**(b*2**(32-22)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-22)%(2**32-1)))+0**(1+(-1)**(b*2**(32-22)%(2**32-1))))))*4194304+\
0**(0**(0**(1+(-1)**(a*2**(32-23)%(2**32-1)))+0**(1+(-1)**(b*2**(32-23)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-23)%(2**32-1)))+0**(1+(-1)**(b*2**(32-23)%(2**32-1))))))*8388608+\
0**(0**(0**(1+(-1)**(a*2**(32-24)%(2**32-1)))+0**(1+(-1)**(b*2**(32-24)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-24)%(2**32-1)))+0**(1+(-1)**(b*2**(32-24)%(2**32-1))))))*16777216+\
0**(0**(0**(1+(-1)**(a*2**(32-25)%(2**32-1)))+0**(1+(-1)**(b*2**(32-25)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-25)%(2**32-1)))+0**(1+(-1)**(b*2**(32-25)%(2**32-1))))))*33554432+\
0**(0**(0**(1+(-1)**(a*2**(32-26)%(2**32-1)))+0**(1+(-1)**(b*2**(32-26)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-26)%(2**32-1)))+0**(1+(-1)**(b*2**(32-26)%(2**32-1))))))*67108864+\
0**(0**(0**(1+(-1)**(a*2**(32-27)%(2**32-1)))+0**(1+(-1)**(b*2**(32-27)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-27)%(2**32-1)))+0**(1+(-1)**(b*2**(32-27)%(2**32-1))))))*134217728+\
0**(0**(0**(1+(-1)**(a*2**(32-28)%(2**32-1)))+0**(1+(-1)**(b*2**(32-28)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-28)%(2**32-1)))+0**(1+(-1)**(b*2**(32-28)%(2**32-1))))))*268435456+\
0**(0**(0**(1+(-1)**(a*2**(32-29)%(2**32-1)))+0**(1+(-1)**(b*2**(32-29)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-29)%(2**32-1)))+0**(1+(-1)**(b*2**(32-29)%(2**32-1))))))*536870912+\
0**(0**(0**(1+(-1)**(a*2**(32-30)%(2**32-1)))+0**(1+(-1)**(b*2**(32-30)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-30)%(2**32-1)))+0**(1+(-1)**(b*2**(32-30)%(2**32-1))))))*1073741824+\
0**(0**(0**(1+(-1)**(a*2**(32-31)%(2**32-1)))+0**(1+(-1)**(b*2**(32-31)%(2**32-1))))+0**(2-(0**(1+(-1)**(a*2**(32-31)%(2**32-1)))+0**(1+(-1)**(b*2**(32-31)%(2**32-1))))))*2147483648

def xorf(a, b):  # floating point
   return 0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-0)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-0)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-0)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-0)%(2.0**32.0-1.0))))))+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-1)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-1)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-1)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-1)%(2.0**32.0-1.0))))))*2.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-2)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-2)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-2)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-2)%(2.0**32.0-1.0))))))*4.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-3)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-3)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-3)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-3)%(2.0**32.0-1.0))))))*8.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-4)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-4)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-4)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-4)%(2.0**32.0-1.0))))))*16.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-5)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-5)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-5)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-5)%(2.0**32.0-1.0))))))*32.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-6)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-6)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-6)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-6)%(2.0**32.0-1.0))))))*64.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-7)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-7)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-7)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-7)%(2.0**32.0-1.0))))))*128.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-8)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-8)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-8)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-8)%(2.0**32.0-1.0))))))*256.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-9)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-9)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-9)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-9)%(2.0**32.0-1.0))))))*512.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-10)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-10)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-10)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-10)%(2.0**32.0-1.0))))))*1024.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-11)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-11)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-11)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-11)%(2.0**32.0-1.0))))))*2048.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-12)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-12)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-12)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-12)%(2.0**32.0-1.0))))))*4096.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-13)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-13)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-13)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-13)%(2.0**32.0-1.0))))))*8192.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-14)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-14)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-14)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-14)%(2.0**32.0-1.0))))))*16384.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-15)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-15)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-15)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-15)%(2.0**32.0-1.0))))))*32768.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-16)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-16)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-16)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-16)%(2.0**32.0-1.0))))))*65536.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-17)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-17)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-17)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-17)%(2.0**32.0-1.0))))))*131072.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-18)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-18)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-18)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-18)%(2.0**32.0-1.0))))))*262144.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-19)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-19)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-19)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-19)%(2.0**32.0-1.0))))))*524288.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-20)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-20)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-20)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-20)%(2.0**32.0-1.0))))))*1048576.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-21)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-21)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-21)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-21)%(2.0**32.0-1.0))))))*2097152.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-22)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-22)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-22)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-22)%(2.0**32.0-1.0))))))*4194304.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-23)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-23)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-23)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-23)%(2.0**32.0-1.0))))))*8388608.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-24)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-24)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-24)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-24)%(2.0**32.0-1.0))))))*16777216.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-25)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-25)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-25)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-25)%(2.0**32.0-1.0))))))*33554432.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-26)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-26)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-26)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-26)%(2.0**32.0-1.0))))))*67108864.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-27)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-27)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-27)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-27)%(2.0**32.0-1.0))))))*134217728.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-28)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-28)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-28)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-28)%(2.0**32.0-1.0))))))*268435456.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-29)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-29)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-29)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-29)%(2.0**32.0-1.0))))))*536870912.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-30)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-30)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-30)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-30)%(2.0**32.0-1.0))))))*1073741824.0+\
0.0**(0.0**(0.0**(1.0+(-1.0)**(a*2.0**(32.0-31)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-31)%(2.0**32.0-1.0))))+0.0**(2-(0.0**(1.0+(-1.0)**(a*2.0**(32.0-31)%(2.0**32.0-1.0)))+0.0**(1.0+(-1.0)**(b*2.0**(32.0-31)%(2.0**32.0-1.0))))))*2147483648.0



>>> import random
>>> for i in xrange(20):
   a=random.randint(0,2**32-1)
   b=random.randint(0,2**32-1)
   print 'a:%8x b:%8x xor:%8x - %8x , %s' % (a, b, a^b, xor(a, b),  xor(a, b))
   print 'floating point: %12.2f' % xorf(float(a),float(b))

a:10dbc5d8 b:9c87fc6b xor:8c5c39b3 - 8c5c39b3 , 2354854323
floating point: 2354854323.00
a:7675bcc4 b:35122712 xor:43679bd6 - 43679bd6 , 1130863574
floating point: 1130863574.00
a:3fd4cd4a b:ceb8e67f xor:f16c2b35 - f16c2b35 , 4050398005
floating point: 4050398005.00
a:925bd59b b: e846797 xor:9cdfb20c - 9cdfb20c , 2631905804
floating point: 2631905804.00
a:8d2506e7 b:c78201a1 xor:4aa70746 - 4aa70746 , 1252460358
floating point: 1252460358.00
a:6953c22c b:e9a1dd67 xor:80f21f4b - 80f21f4b , 2163351371
floating point: 2163351371.00
a:197321b5 b:5eb9abd8 xor:47ca8a6d - 47ca8a6d , 1204456045
floating point: 1204456045.00
a:3ec9737a b:2997f27b xor:175e8101 - 175e8101 , 392069377
floating point: 392069377.00
a:822d1508 b:a80b10da xor:2a2605d2 - 2a2605d2 , 707134930
floating point: 707134930.00
a:faf8ac11 b:69369fba xor:93ce33ab - 93ce33ab , 2479764395
floating point: 2479764395.00
a:8db3d46b b:971874c7 xor:1aaba0ac - 1aaba0ac , 447455404
floating point: 447455404.00
a:4b559b49 b: 800f850 xor:43556319 - 43556319 , 1129669401
floating point: 1129669401.00




I'm sorry to be that guy, but what kind if calculators do you guys have? Or are you just using Python/Perl?

I think a better question is what kind of calculator do you have that can store a formula or code, but doesn't already have XOR? This does:
http://h20331.www2.hp.com/Hpsub/downloads/35_23_Base_Logic_functions.pdf

If it doesn't, but is programmable, you would have a better list of operators you can employ to do the logic functions anyway:
http://www.hpmuseum.org/software/32sbits.htm
Evil-Knievel (OP)
Legendary
*
Offline Offline

Activity: 1260
Merit: 1168



View Profile
January 26, 2014, 09:16:18 AM
Last edit: April 17, 2016, 09:19:55 PM by Evil-Knievel
 #51

This message was too old and has been purged
Evil-Knievel (OP)
Legendary
*
Offline Offline

Activity: 1260
Merit: 1168



View Profile
January 26, 2014, 01:57:01 PM
Last edit: April 17, 2016, 09:19:18 PM by Evil-Knievel
 #52

This message was too old and has been purged
minerpeabody
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
January 26, 2014, 03:30:28 PM
Last edit: January 26, 2014, 04:08:17 PM by minerpeabody
 #53

I just did a few checks, however I am not sure that this operation is really a % 2^32-1 operation.
Shouldn't the modulus operator be linear? When I take it completely out, the function gives back constantly zero. I have not yet taking a deep enough look, but is this behaviour explainable?

Interestingly enough, I was just about to comment on the 2^32-1 operation when the system advised me that you had posted this response.  I'll break down the key elements of the program in steps...

It turned out that using a % 2^32-1 was ESSENTIAL to getting around the road block introduced by trying to implement right shifts as divisions by powers of 2.  The reason for this is because of the importance of getting access to the 1s bit which enables us to mask the input number (N).  Shifting right or rotating (left or right) makes it possible to step through each bit of (N) so that we can then do bitwise operations using inputs A and B.  How? Because any number N mod 2^32-1 is essentially

while (N>2^32-1)
  N=(N >> 32) + (N & 2^32-1)

This algorithm above can be derived using the fact that 2^32= 1 mod 2^32-1. So for any multiple of 2^32, that multiple mod 2^32-1 will be the multiple * 1 (mod 2^32-1). (N & 2^32-1) is the remainder < 2^32-1.  Thus iterating through this loop will eventually lead to N mod 2^32-1.  Fortunately for this challenge, we only go through the loop once to get access to any bit within the input arguments A, B.

As you described in your earlier example (with 8 bits), multiplying by powers of 2 coupled with mod 2^32-1 therefore accomplishes a rotate across 32 bits (mod 2^8-1 would be a rotate across 8 bits).   This is the method we use to set the ones bit to be the bit position within A or B that we are interested in applying the bitwise XOR function to.  The ROTATE works because we start by shifting our number N (A or B) LEFT a given number of bits.  This MAKES SPACE at the right of the number so that all bits LEFT of 2^32 will fit on the right of the number when we add (N >> 32) back on the right side (rotated).

Why is this all important and why do you get zero when you take it out?

You get zero because of the way I implemented the substitute modulus function to access the bits for the bitwise XOR:

THE KEY to understanding the alternate modulo 2 function that 0^0 is THE ONLY combination that yields 1 as an answer, ALL OTHER (positive) exponents of 0 yield 0!

Without access to INTEGER math, and armed only with the tools you gave me, I needed a way to discriminate n%2=0 from n%2=1.  Recognizing that all numbers such that N%2=1 are ODD, and all numbers such that N%2=0 are EVEN, I turned to (-1) for help.  (-1) is one of those unique numbers/bases that is binary sensitive.  Namely, that (-1)^N, no matter what the value of N yields only 2 values depending upon whether N is even or odd.  If N is even then (-1)^N equals 1, if N is odd, then (-1)^N equals -1.

Now to answer where the 0 cames from:

By adding 1 to (-1)^N, we change the range of expected values from -1, 1 to 0 (-1+1), 2 (1+1).

We now plug this into what we know about powers of 0 and get:

0^(1+(-1)^N) = N%2

if N is even, this evaluates to 0^(1+1)= 0^2= 0.  
If N is odd, this evaluates to 0^(1+(-1))= 0^0= 1.

Now we have a way to get the bit from the least most significant bit (the 1s bit) of each operand.  Originally, I like everyone else was right shifting the bits of each operand using division by powers of 2 to the ones bit position leaving the bits that I was no longer interested in to "drop off" the right side using INTEGER math.  However I couldn't use integer math, so without it, I couldn't get the discarded bits to "drop".  Instead they became decimal places to hinder my further calculations.

The sneaky part was getting the bits of interest into the ones position by ROTATING them in from the LEFT using the mod 2^32-1 operation.  In order for my alternate modulo 2 operation to work, I only care about the last bit because the last bit of N determines whether N is even or odd.  Instead of being "dropped" by a shift right operation, "discarded" bits are shifted left of the ones bit where for our purposes, THEY DON'T MATTER.  This is the essential difference between the first iteration of the program and the second iteration.  The first program discards unwanted bits by dropping them off the right using an integer function.  The second program rotates unwanted bits to the left of the ones position.

Again, the ones position is all important because it enables us a way to step through each bit of each operand (A, B), giving us a single bit to plug into our mathematically expressed XOR operation.

Concerning the XOR operation:

This too makes use of the fact that 0^0 is the only combination that yields 1, all other positive exponents yield 0.

So given bit A and bit B, a single bit XOR operation can be described as:

XOR= 0^(0^(a+b)+0^(2-(a+b)))

The truth table for a+b vs 2-(a+b) is:

a  b  a+b  2-(a+b)    0^(a+b)   0^(2-(a+b))  sum(0^(a+b)+0^(2-(a+b)))
0  0      0           2              1                  0                                       1
1  0      1           1              0                  0                                       0
0  1      1           1              0                  0                                       0
1  1      2           0              0                  1                                       1

So according to this table, the sum yields the exact opposite of what we need for XOR.
However 0^N is essentially a NOT function, so by using the sum as an exponent to 0, we
get  exactly what we are looking for:

0^1= 0
0^0= 1
0^0= 1
0^1= 0

So combining this bitwise XOR operation with the alternate modulo 2 implementation and making use of the rotate over 32 bits, we then multiply each bitwise output of the XOR function by a power of 2 representing each bit position of the result.  Lastly we sum these multiplications to build the complete bitwise XORed final output.

Thanks for the brain teaser.  This algorithm was very tricky.  When entering in as a formula, you have to be meticulous because any incorrect value introduced into the wrong exponent will yield 0 due to the fact that 0^0 is the ONLY combination that yields a non-zero value.  Once you start introducing zeros to the build multiplications, you get zeros because zero times anything is zero.

Hopefully you can now see that by removing the mod 2^32-1, you've broken the ROTATE which means that you are still left shifting the number (making space/filling the right most bit with zero) but not adding back the bits from the leftmost side of N.  This is probably evaluating all inputs to the XOR as 0, which would return 0 at every bit position, which would build an output number of 0.

Anyway, I apologize for the length of this message but I hope it explains what you are seeing and is at least a little interesting to others who may have attempted the challenge.

MP


minerpeabody
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
January 26, 2014, 06:13:45 PM
Last edit: January 27, 2014, 06:12:14 AM by minerpeabody
 #54

Surely if the solution exists, you could just google it and paste in the solution? I'm guessing it can't be done ....

It can be done :-)  The TRAP is that without access to integer math, you cannot use division to step through the bits of each operand.  As programmers, we were all stuck on the idea of using division to shift right.  This was natural because we are all used to testing the 1s bit.  The problem is that without integer math, it was proving difficult to discard unwanted bits off the end of an operand because in floating point math, the bits don't go away, they just become decimal places.

Programmers are creatures of habit just like everyone else.  From the beginning it was far more likely that we would try to shift our way through the operands vs rotate our way through them although in retrospect, rotating might have been more flexible though definitely more obscure.

Rotate operations are just as easy to program, it's just that your bits of interest have to be rotated to the ones position from the left vs shifted (or rotated) from the right (which is probably the way 99.9 out of 100 programmers would do it.)

If you think about a rotate across a 4 bit word, take the number 5: 0101 in binary. To rotate across a 4 bit word you have to use 2^4-1, 15.

Most programmers seeking to test the second bit (2^1) would prefer to shift right 1 bit by doing an integer divide by 2, yielding 5/2 or 2: 0010.   This moves the 2nd bit to the 2^0 position where it could be tested.

The tricky part is that we can also get the second bit into the last position using a left rotate.  To accomplish this, we first multiply by 2^3 (Cool, to shift everything 3 bits to the left:

5*8= 0101 << 3 = 0101000 (40)

Now recognize that for a 4 bit word 2^4= 1 (mod 2^4-1) which means that for every multiple of 2^4 we encounter, we are adding 1 (mod 2^4-1) or that multiple multiplied by 1 (mod 2^4-1).  That accounts for the value of the bits left of 2^4, meanwhile all the bits right of 2^4 are either less than 2^4-1 OR 2^4-1 itself.  If all the bits right of 2^4 are 1, you can think of that as the same as 0 (mod 2^4-1).

To get the modulus then we add the multiple of 2^4 to the left of 2^4 to everything right of 2^4.  In other words (40 >> 4) + (40 & 15) = 2+8 = 10 = 1010.  If we check that against the actual 40%(2^4-1) or 40%15 we also get 10.  We have rotated the bit we were interested in to the 2^0 position from the left just as we would have preferred to right shift our way there.  The difference is that opposed to our disposable bit being eaten by integer division, it has appeared at the left of our 4 bit word.

Although the value of the word has changed, it doesn't matter from the standpoint of evaluating the least most significant bit as being even (0) or odd (1). Which for this challenge means that we can step through each bit of both operands to evaluate the xor function.

In my opinion, this was the biggest stumbling block because it required us as programmers to come at it from an unfamiliar angle (left rotates) vs. the approach that we are most acquainted with (right shifts).  Shift left (<< | *2) and shift right (>> | /2) two of the most commonly used tools in the programmer tool shed.  Whether he knew it or not, the OP gave us the actual tool that we needed; force of habit was probably the reason that many of us (myself included) didn't recognize it as such at first.

MP
nickjer
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
January 27, 2014, 02:32:56 AM
 #55

I am in no way saying the last poster's solution is incorrect, but I do want to say you need to be careful with 0^0. Depending on your software choice (since OP has the strangest of conditions) 0^0 is undefined, much like 0/0 is undefined. True, most programming languages will treat 0^0 = 1, but OP may need to double check this with whatever he is using to compute the XOR function. Can check with https://www.wolframalpha.com that 0^0 is undefined.

But I am sure that won't be a problem, unless OP has extremely picky software.
minerpeabody
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
January 27, 2014, 04:43:19 AM
 #56

I am in no way saying the last poster's solution is incorrect, but I do want to say you need to be careful with 0^0. Depending on your software choice (since OP has the strangest of conditions) 0^0 is undefined, much like 0/0 is undefined. True, most programming languages will treat 0^0 = 1, but OP may need to double check this with whatever he is using to compute the XOR function. Can check with https://www.wolframalpha.com that 0^0 is undefined.

But I am sure that won't be a problem, unless OP has extremely picky software.

LORD, this is a tough room! lol.

MP
minerpeabody
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
January 27, 2014, 05:53:01 AM
Last edit: January 27, 2014, 06:05:42 AM by minerpeabody
 #57

Ok, to deal with the last concern about 0^0 being undefined in some implementations, this program uses the same principles but uses a mapping of {-1,1} in place of {0, 1}.  Basically, everything else applies only to go from the former to the latter you must add 1 (+1) then divide by 2.  This works because (-1+1)/2 = 0, and (1+1)/2 = 1.

Using this we must remap our xor and alternate modulus functions such that:

xor($a,$b)= ((1+((-1)**($a+$b)+(-1)**(2-($a+$b)))/(-2))/2)

and our alternate modulo 2 function looks like:

((1-(-1)**$n)/2) = $n % 2

why?

because when $n is odd we get (1-(-1))=2/2= 1,
      and when $n is even we get (1-1)=0/2= 0.

Literally everything else (including the rotations to rotate the bits of interest to the 1s digit) is the same.

THE LASTEST (and hopefully last) PROGRAM:
#!/usr/bin/perl

my $buf=<STDIN>;
my ($a, $b)= split /\s/, $buf;

my $result=
((1+((-1)**(((1-(-1)**($a*2**(32-0)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-0)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-0)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-0)%(2**32-1)))/2))))/(-2))/2)*2**0+
((1+((-1)**(((1-(-1)**($a*2**(32-1)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-1)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-1)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-1)%(2**32-1)))/2))))/(-2))/2)*2**1+
((1+((-1)**(((1-(-1)**($a*2**(32-2)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-2)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-2)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-2)%(2**32-1)))/2))))/(-2))/2)*2**2+
((1+((-1)**(((1-(-1)**($a*2**(32-3)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-3)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-3)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-3)%(2**32-1)))/2))))/(-2))/2)*2**3+
((1+((-1)**(((1-(-1)**($a*2**(32-4)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-4)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-4)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-4)%(2**32-1)))/2))))/(-2))/2)*2**4+
((1+((-1)**(((1-(-1)**($a*2**(32-5)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-5)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-5)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-5)%(2**32-1)))/2))))/(-2))/2)*2**5+
((1+((-1)**(((1-(-1)**($a*2**(32-6)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-6)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-6)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-6)%(2**32-1)))/2))))/(-2))/2)*2**6+
((1+((-1)**(((1-(-1)**($a*2**(32-7)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-7)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-7)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-7)%(2**32-1)))/2))))/(-2))/2)*2**7+
((1+((-1)**(((1-(-1)**($a*2**(32-8)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-8)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-8)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-8)%(2**32-1)))/2))))/(-2))/2)*2**8+
((1+((-1)**(((1-(-1)**($a*2**(32-9)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-9)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-9)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-9)%(2**32-1)))/2))))/(-2))/2)*2**9+
((1+((-1)**(((1-(-1)**($a*2**(32-10)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-10)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-10)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-10)%(2**32-1)))/2))))/(-2))/2)*2**10+
((1+((-1)**(((1-(-1)**($a*2**(32-11)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-11)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-11)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-11)%(2**32-1)))/2))))/(-2))/2)*2**11+
((1+((-1)**(((1-(-1)**($a*2**(32-12)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-12)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-12)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-12)%(2**32-1)))/2))))/(-2))/2)*2**12+
((1+((-1)**(((1-(-1)**($a*2**(32-13)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-13)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-13)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-13)%(2**32-1)))/2))))/(-2))/2)*2**13+
((1+((-1)**(((1-(-1)**($a*2**(32-14)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-14)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-14)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-14)%(2**32-1)))/2))))/(-2))/2)*2**14+
((1+((-1)**(((1-(-1)**($a*2**(32-15)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-15)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-15)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-15)%(2**32-1)))/2))))/(-2))/2)*2**15+
((1+((-1)**(((1-(-1)**($a*2**(32-16)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-16)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-16)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-16)%(2**32-1)))/2))))/(-2))/2)*2**16+
((1+((-1)**(((1-(-1)**($a*2**(32-17)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-17)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-17)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-17)%(2**32-1)))/2))))/(-2))/2)*2**17+
((1+((-1)**(((1-(-1)**($a*2**(32-18)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-18)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-18)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-18)%(2**32-1)))/2))))/(-2))/2)*2**18+
((1+((-1)**(((1-(-1)**($a*2**(32-19)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-19)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-19)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-19)%(2**32-1)))/2))))/(-2))/2)*2**19+
((1+((-1)**(((1-(-1)**($a*2**(32-20)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-20)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-20)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-20)%(2**32-1)))/2))))/(-2))/2)*2**20+
((1+((-1)**(((1-(-1)**($a*2**(32-21)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-21)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-21)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-21)%(2**32-1)))/2))))/(-2))/2)*2**21+
((1+((-1)**(((1-(-1)**($a*2**(32-22)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-22)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-22)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-22)%(2**32-1)))/2))))/(-2))/2)*2**22+
((1+((-1)**(((1-(-1)**($a*2**(32-23)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-23)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-23)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-23)%(2**32-1)))/2))))/(-2))/2)*2**23+
((1+((-1)**(((1-(-1)**($a*2**(32-24)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-24)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-24)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-24)%(2**32-1)))/2))))/(-2))/2)*2**24+
((1+((-1)**(((1-(-1)**($a*2**(32-25)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-25)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-25)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-25)%(2**32-1)))/2))))/(-2))/2)*2**25+
((1+((-1)**(((1-(-1)**($a*2**(32-26)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-26)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-26)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-26)%(2**32-1)))/2))))/(-2))/2)*2**26+
((1+((-1)**(((1-(-1)**($a*2**(32-27)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-27)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-27)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-27)%(2**32-1)))/2))))/(-2))/2)*2**27+
((1+((-1)**(((1-(-1)**($a*2**(32-28)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-28)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-28)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-28)%(2**32-1)))/2))))/(-2))/2)*2**28+
((1+((-1)**(((1-(-1)**($a*2**(32-29)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-29)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-29)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-29)%(2**32-1)))/2))))/(-2))/2)*2**29+
((1+((-1)**(((1-(-1)**($a*2**(32-30)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-30)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-30)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-30)%(2**32-1)))/2))))/(-2))/2)*2**30+
((1+((-1)**(((1-(-1)**($a*2**(32-31)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-31)%(2**32-1)))/2))+(-1)**(2-(((1-(-1)**($a*2**(32-31)%(2**32-1)))/2)+((1-(-1)**($b*2**(32-31)%(2**32-1)))/2))))/(-2))/2)*2**31;

print "$result\n";

At this point, the bottom line is that BOTH the last 2 programs should satisfy the requirements and work.  This program avoids the 0^0 convention by substituting -1 for 0 and adjusting our alternate modulo 2 and xor functions accordingly.

(Thanks nickjer)

MP

BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1137

All paid signature campaigns should be banned.


View Profile WWW
January 29, 2014, 09:17:29 AM
 #58

Very clever.  EK - did you pay up?

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
minerpeabody
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
January 29, 2014, 06:41:27 PM
 #59

Very clever.  EK - did you pay up?

Nope, at least not yet-- But I would like to mention that I *do* accept bitcoin :-)

I think we can all agree that it was an interesting challenge, so much so that even in spite of the novel I've written here, I'm writing a blog entry about the problem and its solution.

MP
Evil-Knievel (OP)
Legendary
*
Offline Offline

Activity: 1260
Merit: 1168



View Profile
January 30, 2014, 08:55:10 AM
Last edit: April 17, 2016, 09:17:12 PM by Evil-Knievel
 #60

This message was too old and has been purged
Pages: « 1 2 [3] 4 5 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!