# Thread: Rounding numbers in binary representation?

1. Say I have some decimal expansion , where and represent the tenths and hundredths digits respectively. The convention for rounding would have... when and  if and  if and  when and ...assuming I'm rounding to the nearest tenth (I made the above formula myself, possibility of an error).

Now, I'm trying to see how rounding would apply to binary expansions (note, I'm speaking in a purely mathematical context)

Say I have , which is equivalent to . I'm guessing the digits in binary now represent the halves and quarters (?) digits respectively -- meaning I now have to round to the nearest half. Well, is exactly between and , so there is no true single solution. Or do I retain the round-up-at-half rule just like in decimal?  2. Round up at half is the usual convention.  3. Originally Posted by mathman Round up at half is the usual convention.
Yes.

This is not really a mathematical question, but rather one more germane to engineering or experimental science. The basic rationale is that all measured quantities are approximations (most real numbers are not expressible as a finite decimal) and given any decimal approximation to some quantity, it is likely that a more accurate measurement would result in at least one non-zero digit to the right of the last one that is presented. So if that last number presented is a 5 (base ten) then the actual quantity is a bit larger (the only way this is not true is if all digits to the right of the "5" in an infinite expansion are 0 which is not likely) and hence one rounds up a digit. The same rationale carries over to a representation using any other base.

On the other hand one does not normally use base 2 in those sorts of applications, so one ought to think a bit about what one is really trying to do. Base 2 gives a rather coarse scale with which to work, and I don't know why anyone would use it in any application other than one involving digital circuits.  4. Originally Posted by mathman
Round up at half is the usual convention.
Thanks. Originally Posted by DrRocket Yes. This is not really a mathematical question, but rather one more germane to engineering or experimental science.
I realize now. Initially, I was just concerned with different base representations of the real numbers. In this case, I approached binary seriously for the first time, with no regard to its popular place in computer coding (hence "purely mathematical context"). Still, I wondered how rounding would apply and that in itself is more native to application. So my words were rather misplaced.

However, I guess one could still view it in a pure sense. Can't rounding be formalized as...?

Consider the rounding function where . For some real number in base , is defined as the number for which is closest to whose expansion terminates at .

So would round to the nearest hundredth, giving , because it is the closest number to whose expansion terminates at (i.e. rounding to the nearest hundredth).

Sorry if it seems pointless, but one can be curious.  5. Originally Posted by epidecus Thanks.

I realize now. Initially, I was just concerned with different base representations of the real numbers. In this case, I approached binary seriously for the first time, with no regard to its popular place in computer coding (hence "purely mathematical context"). Still, I wondered how rounding would apply and that in itself is more native to application. So my words were rather misplaced.

However, I guess one could still view it in a pure sense. Can't rounding be formalized as...?

Consider the rounding function where . For some real number in base , is defined as the number for which is closest to whose expansion terminates at .

So would round to the nearest hundredth, giving , because it is the closest number to whose expansion terminates at (i.e. rounding to the nearest hundredth).

Sorry if it seems pointless, but one can be curious.
If you want to approach the question from a purely mathematical perspective, then probably the way to go is to start with the "greatest integer funtion":

[x]= the largest integer less than or equal to x.

[x] is also known as "the integer part of x".

Then define the step function S(x) = 0 if x<1/2 and S(x)=1 if x>/= 1/2

So to round to the nearest integer you have [x] +S(x). To round to some other decimal place consider 10^n X in place of X and then multiply by 10^(-n),

You can extend this to any base system that you choose in the obvious way. But itis not a very interesting construction.

In mathematics there a lot things than can be done. There are many fewer things that are interesting and useful.  6. Originally Posted by DrRocket If you want to approach the question from a purely mathematical perspective, then probably the way to go is to start with the "greatest integer funtion":

[x]= the largest integer less than or equal to x.

[x] is also known as "the integer part of x".

Then define the step function S(x) = 0 if x<1/2 and S(x)=1 if x>/= 1/2

So to round to the nearest integer you have [x] +S(x). To round to some other decimal place consider 10^n X in place of X and then multiply by 10^(-n),

You can extend this to any base system that you choose in the obvious way. But it is not a very interesting construction.
Fair, and likely more conventional than my methods given the wide usage of the floor and ceiling functions.

In mathematics there a lot things than can be done. There are many fewer things that are interesting and useful.
And there are also many things that can be interesting without being very useful or applicable, while other things can be quite useful but rather dull and uninteresting.

I just found binary expansions a rather attractive representation given they approach a number through summation of powers of two (consecutive halving). Either there's a "half" (whatever power of 2) there or there isn't, 0 or 1, and on to the next digit.  7. Originally Posted by epidecus I just found binary expansions a rather attractive representation given they approach a number through summation of powers of two (consecutive halving). Either there's a "half" (whatever power of 2) there or there isn't, 0 or 1, and on to the next digit.
There is nothing particularly unique about binary expansions. You still have the same sort of non-uniqueness that you have with base ten.

In binary 0.111111.......... = 1, just as in decimal 0.999999.......... = 1

Binary is of interest only because it is easy to implement in a machine as there are devices which naturally can be put into two distinct states. Other bases, powers of 2, also find application in computing machines. For other applications the traditional decimal system has shown itself, over centuries, to be convenient.

Very little of mathematics is dependent on the selection of any particular basis, the exception being a few odd theorems of number theory.  8. Originally Posted by DrRocket There is nothing particularly unique about binary expansions. You still have the same sort of non-uniqueness that you have with base ten.

In binary 0.111111.......... = 1, just as in decimal 0.999999.......... = 1
That's interesting. Whenever 1=0.9999... is brought up, it always seems to be met with firm doubt from a few, at least initially. They only doubt it because it is non-intuitive, but the usual arguments tend to do the trick, such as:

1/3 = 0.33333...
3 x (1/3) = 0.99999...
1 = 0.99999...

However, some suspect that there's something weird going on behind-the-scenes in the algebra, and that it doesn't really work out like that. But now in light of base expansions, it looks like a more solid argument can be drawn from the series definition. Now it's merely a matter of a converging limit, and this is trivial for those who've studied infinite series. This argument can also be generalized to any working base the obvious way.  9. Originally Posted by epidecus  Now it's merely a matter of a converging limit, and this is trivial for those who've studied infinite series. This argument can also be generalized to any working base the obvious way.
Geometric series are a simple and important special case:   So, if  and   Posting Permissions
 You may not post new threads You may not post replies You may not post attachments You may not edit your posts   BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Trackbacks are Off Pingbacks are Off Refbacks are On Forum Rules