how floating point numbers work in C
Posted
by hatorade
on Stack Overflow
See other posts from Stack Overflow
or by hatorade
Published on 2010-04-25T01:49:25Z
Indexed on
2010/04/25
1:53 UTC
Read the original article
Hit count: 299
Let's say I have this:
float i = 1.5
in binary, this float is represented as:
0 01111111 10000000000000000000000
I broke up the binary to represent the 'signed', 'exponent' and 'fraction' chunks.
What I don't understand is how this represents 1.5.
The exponent is 0 once you subtract the bias (127 - 127), and the fraction part with the implicit leading one is 1.1.
How does 1.1 scaled by nothing = 1.5???
© Stack Overflow or respective owner