Question: Hello, Can you please fix this c++ pointer; #include using namespace std; int main() { float v_f = 9.515e+28; bitset <32> v_b(*(int *)&f); cout <
Hello,
Can you please fix this c++ pointer;
#include
using namespace std;
int main() {
float v_f = 9.515e+28;
bitset<32> v_b(*(int *)&f);
cout << b << " ";
return 0;
/*
v_b = (sign)-(exponent + 127)-(mantissa)
v_b = 0-11011111-00110011011100100011110
v_b = 0-223-1685790
v_b = (-1^sign) * 1.mantissa * (2^exponent)
v_b = 1.1685790 * (2^(223-127))
v_b = 1.1685790 * (2^96)
v_b = 9.25843669227565e+28
v = 1.1685790 * (2^96) = 1.1685790 * (2^52) * (2^44)
*/
}
Thank you,
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
