I have a bit problem. Given: some real number(for example -474.875) Task: extract BINARY value of mantissa For number -474.875 I need this value 1,11011010111 * 2^8 I have a programm:
const float d = -474.875f;
int exponent;
const float mantissa = frexp(d, &exponent);
double prev = mantissa * pow(2, exponent);
It calculates decimal mantissa (for my number it is -0.927490234) and exponent (9). I'm tried to convert this mantissa to binary... but failed... I got other value. To get original value: mantissa* 2^exponent. QUESTION: How I can get binary value of mantissa? May be it is possible to do it in more pretty way?