What is the fastest way to compare a mark on double?
I know that it doublehas a โsign bitโ, but I'm not sure if the way to โlook for itโ in its binary representation is a good idea or not.
Troubleshooting portability issues, can someone tell me what is happening with this code in MSVC ++?
#include <stdio.h>
int main()
{
double z = 5.0 ;
__int64 bitSign ;
__int64 *ptr ;
ptr = (__int64*)&z ;
for( __int64 sh = 0 ; sh < 65 ; sh++ )
{
bitSign = 1L << sh ;
printf( "Bit# %d (%llx): %lld\n",
sh, bitSign, ( (*ptr) & bitSign) ) ;
}
}
Firstly, why does it start with bit 32, although I only moved one bit?
Secondly, is it okay for me to check the 64th bit doubleto check its sign in MSVC ++?
source
share