No, the program itself is not the ultimate - the technique is. By comparison, a very
simple C++ function to index the last combination of 729c17 can take a couple of
seconds using n!/k!(n-k)!. My JavaScript version takes just under a second and a VB6
version can churn through more than 16000 per second.
IEEE is not required. I learned a valid method of summing big numbers in early primary school.
Taken a byte at a time:
Code:
250 64 172 224 = FA 40 AC E0 = 4198542560
+ 5 96 55 207 = 05 60 37 CF = 90191823
255 160 228 175 = FF A0 E4 AF = 4288734383
Using digits 0 to 9, or bytes 0 to 255 or 32bit digits 0 to 2^32-1 makes no difference.
Multiplication is exactly the same. Subtraction and division require a little more effort
but not much. And as for validating them, use string manipulation to manually work
out the answer of a random equation using paper and pencil method and compare to
a 128bit method. Repeat a million times and alert on error. No IEEE validation required.
additional:
Assembly source code for adding two 128bit numbers stored as big endian composed
of sequential little endian dwords:
Code:
bigAdd proc STDCALL dest:DWORD, src:DWORD
mov edi,dest ; destination address
mov esi,src ; source address
xor ecx,ecx ; zero all of ecx and clear carry flag
mov cl,4 ; count 4 dword addresses
lp00: mov eax,[esi+ecx*4-4] ; get one surce dword
adc [edi+ecx*4-4],eax ; add and carry source to destination
dec cx ; decrement counter (not affecting carry flag)
jnz lp00 ; loop and next two higher level dwords
ret
bigAdd endp
Bookmarks