• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

how to convert decimal to floating point and back?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

-N-

Member
Joined
Dec 15, 2002
Location
so.ca
Does anyone know how? I tried looking on google but the explainations aren't very good. Either that or i still don't get it.

I know the first section is the pos/negative, 2nd section is the exponent and third is the fraction. For the exponent I know you take the binary number and subtract 127 from it to get the exponent in decimal. But that's it. :confused:

Can someone explain it in newbie terms to me plz? really appreciated...
 
yea floating point binary form.

can somebody break down an basic explaination for me?

my textbooks gives like an overview of what it is but doesn't give a formula of any type.

i read these and i still don't understand how to convert a number into the binary with decimals. Plus the book and each site makes it more confusing to me when i read different stuff..

http://stevehollasch.com/cgindex/coding/ieeefloat.html
http://www.nuvisionmiami.com/books/asm/workbook/floating_tut.htm

If anyone could help me that would be great.
 
IEEE 754 arithmetic standards...

In binary, numbers are represented as a group of bits (you obviously know this much). Let's assume we're working with single-precision 32-bit floats and double-precision 64-bit floats (although in reality the x86 floating point architecture converts internally to 80 bits). This is known as IEEE 754, and is used commonly on industry standard architectures.

The bits in our 32-bit floating point word are as follows:

[ 1 | 11 | 20 ]
sign Exponent Significand
("s") ("E")

...and a floating point number would be represented like this on paper:

(-1)^s * (1 + Significand) * 2^E (Output is base 2.)

Pay attention! the exponent field has a bias to it in IEEE 754 standards. For single-precision, the exponent is _really_ (Exp_field - 127). (This allows the computer to store both positive and negative exponents in a really small place. For double precision, the bias is 1023 => exponent = Exp_field - 1023). Values of all 0 and all 1 for the sign, exponent and significand fields are reserved.

Reading and understanding floating point should be mandatory before you are allowed to use a graphing calculator...because too many people take their outputs as pure gospel, not realizing that since it _is_ a floating-point machine, that -1.999999999999x on your derivative screen is actually a -2. :)

Good luck.
 
Back