Floating points - Binary

Hello everyone,

I'm getting started with C++ and programming and want to learn the basics to make sense of the rest of the goodies. I just learned about the binary conversion of, e.g. integer and char and how if I write char c = 8 the binary of this is 00001000 which is 2^3 and the rest are 0s.

But I tried this with float f = 8 and it shows:
01000001 00000000 00000000 00000000

If I were to use the same argumentation, then this binary would be 65. Can someone explain how this floating number has a different result?

you should read the WIKI or other site on IEEE floating point format. It is nontrivial.

The 10 cent answer is that floating point is a sign, a base, and an exponent shoved into some bits in a way that can represent the values.

Last edited on
Hey thanks for the reply and sorry for just getting around to responding. Your reply is pretty much what I wanted to know. Thanks again.
Topic archived. No new replies allowed.