How to Convert Floating Point Numbers to Binary


"Floating point" is the way computers represent real numbers like 11.625. These numbers are really two numbers -- the mantissa and the exponent. The mantissa consists of the actual digits and the exponent just tells where the decimal point goes. This is similar to writing 11.625 in scientific notation: 1.1625 X 10^1. The mantissa is 1.1625 and +1 is the exponent. Converting this into binary notation is a straightforward process that takes only a few steps.

  • Change the part of the number to the left of the decimal point into binary notation by a series of divisions by 2. If you are converting 11.625 into binary, you should repeatedly divide 11 -- and then the quotients -- by 2 until the 11 is gone. The remainders, in the reverse order of appearance, will be the binary conversion. 11/2 = 5 with remainder 1, 5/2 = 2 with remainder 1, 2/2 = 1 with remainder 0 and 1/2 = 0 with remainder 1. The remainders, in reverse order of appearance, were 1, 0, 1 and 1, therefore 11 decimal = 1011 binary.

  • Change the part of the number to the right of the decimal point into binary notation by a series of multiplications by 2. To convert 0.625 to binary, start by multiplying 0.625 by 2 to get 1.25. Record the 1, and continue with the 0.25. Now multiply 0.25 by 2 to get 0.5. Record the 0, and continue with the 0.5. Finally, multiply 0.5 by 2 to get 1.0. Record the 1, and stop because there is nothing left to multiply. This means that 0.625 decimal = 0.101 binary.

  • Put the two parts of the conversion process together to get 11.625 decimal = 1011.101 binary. In the computer this binary string would be represented by a binary floating point schema. The exact schema for setting up binary floating point varies from one computer manufacturer to another but the mantissa would be 1011101 and the exponent would probably be 3 -- which is 11 in binary. If you were using 16 bit registers with 11 bits for the mantissa followed by 5 bits for the sign, the floating point conversion would be 0000 1011 1010 0011.

Tips & Warnings

  • You can do some arithmetic on numbers in floating point binary without doing any conversion. For example, doubling a number means incrementing or decrementing the exponent -- depending on the representational schema.
  • In some schema, the leftmost bit in both the mantissa and exponent field are reserved for the sign bit. In the conversion of decimal 11.625 to 0000 1011 1010 0011, the first bit is the sign of the mantissa and the 16th bit is the sign of the exponent. Apparently, in this coding scheme the 0 indicates positive and 1 represents negative.


  • Photo Credit Comstock/Comstock/Getty Images
Promoted By Zergnet



Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!