>Hi,
>
>>>Just tested (you never know with computers): bitand(2^32, 2^32) returns 0 since we are exceeding 32 bits (2^31 ..... 2^0)
><<
>
>Yea, you're right - realised my example was only 24 bit straight after posting. So how about, for x and y:
>
>nresult = BITAND(int(x/0xffffffff),int(y/0xffffffff))* 0xffffffff ;
>+ BITAND(Mod(x,0xffffffff),mod(y,0xffffffff))
>
>
>Regards,
>Viv
Viv,
Don't think that will work if you want to store it all in one numeric variable (internally kept as a double)
Don't recall the internal format of a double (ie, the number of bits for the mantissa is 52 or 53 bits I believe). Looking at the system capacities, they say 16 digits of precision
16 digits : ln(10^16)/ln(2) = 53.15 bits = ln2(10^16)
Doing a test:
a=0xffffffff * 2^32 + 0xffffffff
?mod(a,0x80000000) yields 0.00, ie precision lost
You can safely go up to 52 bits.
Cheers,
Gregory