Xyon (xyon) wrote,
Xyon
xyon

Binary Number Less Than One Are Crazy

Let suffix 'd' = 10
Let suffix 'b' = 2

i.e. 111b = 7d

So I've known for a while that 0.1d was not representable as a finite binary number, but I didn't realize that it was almost all of 0.x where x is a single digit.

And before you're too quick to judge, remember that 0.13 = 0.[3]d where [] means "repeating (infinitely)"

0.1d = 0.0[0011]b
0.2d = 0.[0011]b
0.3d = 0.0[1001]b
0.4d = 0.[0110]b
0.5d = 0.1b
0.6d = 0.[1001]b
0.7d = 0.1011[0011]b
0.8d = 0.[1100]b
0.9d = 0.1[1100]b

To convert the integer part we repeatedly divide it by 2, keeping only the whole part and noting down the remainder at each step, until we reach zero. At the end of this, we have the binary representation of the integer by reading the remainders in reverse order.

To convert the fractional part we repeatedly multiply by 2, keeping only the fractional part and noting down the whole part, until we reach zero. At the end of this we have the binary representation of the integer by reading the whole parts in order.
Binary Representation and Computer Arithmetic
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 3 comments