Homework Help: Converting Decimal to Binary?
Learn how to convert any number to binary in under 1 minute.
Anyone know the simplest way to convert binary to decimal and backforth?
How do you represent decimals in binary?
It is actually very simple. Computers generally store non-integer numbers in a format called floating point. It the same principle as scientific notation, which you may have heard of.
Essentially you split the number into two parts, the significand and the exponent. 0.01 would be represented in decimal as 1 and -2 as it is 1x10**-2** .
Obviously the computer stores these numbers in binary so instead of x*10y it stores them as a*2b . This conversion is actually really quite complicated so you can have a play with this calculator For 0.01 it becomes 0 01111000 01000111101011100001010 where I have split it into 3 parts for easy reading. The first is the sign (0 because positive) then the next 8 digits are the exponent (-7 in binary) and the last part is the mantissa.
If this looks overly complex remember that 0.01 is a simple number to write in decimal but is hard to write in binary.
You might also have heard the term FLOPS as a measure of cpu performance. This is the number of FLoating Point Operations Per Second that the cpu can carry out.
More on reddit.com