1

This question comes from this answer to my another question.

I have the following two statements in binary to compare: $$ |0.11 - 0.1101110111...|\quad\quad|1.00 - 0.1101110111...|$$

I need to figure out the way to make comparison based only on the number $0.01$ (the number added to $0.11$ to create next number $1.00$) and the first two digits $0.00011$ after the $0.11$ part in the number $0.1101110111...$. I can write it like that:

$$ |0.11 - 0.1101110111...|\quad\quad|0.01 + 0.11 - 0.1101110111...|$$

But how to proceed?

According to the answer I linked to, if $0.00011$ is less than half of $0.01$, then the left statement is smaller. How can I arrive at that conclusion from the starting form using mathematical operations?

  • 2
    $|0.11-0.11011|=0.11011-0.11=0.00011$, and $|1.00-0.11011|=1-0.11011=0.00101$. The first is obvious. To get the second you could write $1=0.11112$ and then subtract. – almagest May 25 '16 at 17:25
  • @almagest, thanks, I slightly modified my original question, can please see now if your comment still holds true? – Max Koretskyi May 25 '16 at 18:48
  • 1
    The basic idea is the same the first difference is simply $0.1101110111\dots-0.11=0.0001110111\dots$. The second difference is $0.1111111112-0.1101110111=0.001000100\dots$. – almagest May 25 '16 at 18:53
  • @almagest, thanks, I still can't see how I can figure out the way to make comparison based only on the number $0.01$ (the number added to $0.11$ to create next number 1.00) and the first two digits $0.00011$ after the $0.11$ part in the number $0.1101110111...$. Can you please elaborate more in a separate answer (not a comment)? – Max Koretskyi May 26 '16 at 05:59

1 Answers1

1

Don't get confused by the change of base. The first expression is obviously less than the second because you are subtracting the same number from .11 as you are from 1, and .11 is a fraction between 0 and 1 so it must be less than 1. $$ $$ To add/subtract binary, you can use operations essentially identical to base 10 addition/subtraction. For example, .11-.11011=-.00011 because you cancel out the similar .11's, leaving only the -.00011. On the other hand, it is reasonable to solve 1-.11011 with long subtraction. This works the same as long subtraction in base 10 in that when you subtract and get -1, you just replace the -1 with +1 by adding "10, also known as 2", then carry the 1. If you carry the 1 onto a pre-existing 1, you add 1+1 and get 2=10, so you must change the 2 to a 0 and carry the 1 again. Thus, it is exactly like base 10 except the cap is now 2 instead. However, there is a way you can avoid doing long subtraction with 1-.11011, which is saying 1-.11111=.00001, but .11111-.11011=.00100, so 1-.11011=.00001+.00100=.00101

The above answer is from a previous version of the question and neglects the absolute value signs.

After edit of question: For this irrational number inside the absolute value, the way to go is to look at the third place after the decimal. If it is a 1, it is closer to 1. If it is a 0, it is closer to .11 Since it is a 0, we can round down to .11 because it is on the lower side of the halfway point between .11 and 1.

In practice, in this case the number is .110...,so we can say it is closer to .11. Therefore, the first revised expression is greater because it has a greater distance from 1.

thecat
  • 1,838