I am working on a programming language and in short I need to steal the 3 least significant bits from a double, when working with an integer I can do the following
long long int make(long long int x)
{
return x << 3;
}
long long int take(long long int x)
{
return x >> 3;
}
However when doing that to doubles (first converting into a long long binary representation of course) it simply makes the number not anywhere like it was. Worth to mention that my code will only ship to platforms where CHAR_BIT == 8.
Ideas?