## Microsoft Interview Question

Software Engineer / DevelopersTo convert numbers between 0 and 1, take the decimal expression and repeat-

edly multiply it by 2. At each step, keep track of the integer part of the

result but do not carry it along in subsequent multiplications. For

example, convert decimal 0.7 to binary:

0.7 * 2 = 1.4

0.4 * 2 = 0.8

0.8 * 2 = 1.6

0.6 * 2 = 1.2

0.2 * 2 = 0.4

0.4 * 2 = 0.8

0.8 * 2 = 1.6

0.6 * 2 = 1.2 etc. Note that we have started to repeat previous

results. Now read the integer parts occurring on

the right side, from the top down: the binary

representation of decimal 0.7 is 0.1011001100...

where the "1100" repeats forever.

so whatever number after decimal ends in 5 will become 0 eventually following above procedure and wil not be non-repeating..... therefore can be represented accurately.

319 (or 319.0), 63.5, 1/16(or 0.0625), 5.390625 can be represented accuratley in binary.

319, 63.5, 1/16, 5.390625 can be represented accurately.

- PP June 10, 20070.1, 1.32 can't be.