A float is 1 sign bit, 8 exponent bits (biased by 127) and 23 mantissa bits. 1.0 has exponent 127 (2⁰) and mantissa 0. 0.1 cannot be stored exactly – its mantissa is a repeating pattern, which is why 0.1 + 0.2 != 0.3. Reading another union member like this is allowed in C.
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!
We use Google Analytics cookies to see how LearnFrenzy is used and make it better, and Google AdSense to keep it free.
No analytics or ad cookies are set until you accept. Privacy Policy
·
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!