O_o
Before you could use any simple shift or bit fiddling mechanism you'd have to know that the values you are operating on fall within a certain range. If the value is outside this range you'll get "weird" results.
That said, I use a hack (below) for a lot of systems. I doubt it will be faster than simply multiplying for any desktop chip.
Soma
Code:
#include <iostream>
#include <sstream>
typedef unsigned long long uint64_t;
static const uint64_t IEEELFMUL1024(0xA0000000000000LLU);
int main
(
int argc
, char ** argv
)
{
union
{
uint64_t qword;
double value;
};
if(2 == argc)
{
std::istringstream sin(argv[1]);
sin >> value;
}
else
{
std::cin >> value;
}
qword += IEEELFMUL1024;
std::cout << value << '\n';
return(0);
}