Round it up!

Circle of Life

Circle of Life

Quite often a visit to Wikipedia starts of a train of thought that might end up as a post here, and often I forget the reason that I was visiting Wikipedia in the first place. However in this case I remember what sparked my latest trip to Wikipedia.

I was looking at the total number of posts that I have made and it turns out that I have posted 256. This is post number 257, which is a prime number incidentally. To many people 256 is not a particular interesting number but to those who program or have an interest in computers or related topics, it is a round number.

US 256

US 256

A round number, to a non-mathematician is a number with one or more zeroes at the end of it. In the numbering system with base 10, in other words what most people would considered to be the normal numbering system, 1000 would be considered to be a round number. In many cases 100 would also be a round number and sometimes 10 would be as well.

In the decimal system, which is another name for the normal numbering system, the number 110 would probably not usually be considered a round number. However, if we consider numbers like 109, 111, 108 and 112, then 110 is a round number relative to those numbers. Rounding is a fairly arbitrary thing in real life, usually.

We come across round numbers, or at least rounded numbers in the supermarket on a daily basis, if we still use cash. Personally I don’t. I recall when the one cent and two cent coins were introduced people were appalled that the supermarkets would round their bills to the nearest convenient five cents.

5 lirot

5 lirot

 

So a person would go to a supermarket and their purchases would total to, say, $37.04. The cashier would request payment of $37.05. Shock! Horror! The supermarket is stealing $0.01 off me! They must be making millions from all these $0.01 roundings. In fact, of course, the retailer is also rounding some amounts down too, so if the bill was $37.01 the customer would be asked to pay only $37.00. So the customer and the supermarket, over a large number of transactions, would end up even.

Then of course the 5 cents coins were removed and this added an extra dilemma. What if the total bill was $37.05? Should the customer’s bill be rounded to $37.00 or to $37.10? This is a real dilemma because, if the amount is rounded up, then the supermarket pockets five cents in one ten cases, and if it is rounded down the supermarket loses five cents in one in ten cases. If the supermarket a thousand customers in a day, one hundred of them will pay five cents more than the nominal amount on their bill, meaning that the supermarket makes a mere five dollars.

Big Money

Big Money

The emotional reaction of the customer, though, is a different thing. He or she may feel ripped off by this rounding process and say so, loudly and insistently. Not surprisingly most supermarkets and other retailers choose to round such bills down. Of course, all the issues go away if you don’t use cash, but instead use some kind of plastic to pay for your groceries, as most people do these days.

There are degrees of roundness. In one context the number 110 would be considered round, if you are rounding to the nearest multiple of ten. If you are rounding to the nearest multiple of one hundred, then 110 is not a round number, or, in other words a rounded number. If we are rounding to the nearest multiple of three, then 110 is not a rounded number but 111 is (111 is 37 multiplied by 3).

Binary Backdrop

Binary Backdrop

Real numbers can be rounded too. Generally, but not always, this is done to eliminate and small errors in measurement. You might be certain that the number you are reading off the meter is between 3.1 and 3.2, and it seems to be 3.17 or so, so you write that down. You take more measurements and then write them all down.

Then you use that number in a calculation and come up with a result which, straight out of the calculator, has an absurd number of decimal places. Suppose, he said, picking a number out of the air, the result is 47.2378. You might to choose to truncate the number to 47.23, but the result would be closer to the number that you calculated if you choose to round it 47.24.

Currency Symbols

Currency Symbols

A quick and easy way to round a real number is to add half of the order of the smallest digit that you want to keep and then truncate the number. For the example number the order of the smallest digit is 0.01 and half of that is 0.005. Adding this to 47.2378 gives 47.2428, and truncating that leaves 47.24. Bingo!

Another way of dealing with uncertain real numbers such as results from experiments is to calculate an error bound on the number and carrying that through to the calculated result. This is more complex but yields more confidence in the results than mere rounding can.

Tube

Tube

To get back to my 256th post. Why did I say that this is a round number in some ways? Well, if instead of using base 10 (decimal), I change to using base 16 (hexadecimal) the number 256 (base 10) becomes 100 (base 16), and those trailing zeroes mean that I can claim that it is a round number.

Similarly, if I choose to use base 2 (binary), 256 (base 10) becomes 100000000 (base 2). That is a really round number. But if I use base 8 (octal), 256 (base 10) becomes 400 (base 8). It’s still a round number but not as round as the binary and hexadecimal versions are, because it start with the digit 4. As a round number its a bit beige.

It’s interesting (well it is interesting to me!) that there are no real numbers in a computer. Even the floating point numbers that computers manipulate all the time are not real numbers. They are approximations of real number stored in a special way (which I’m not going to into).

General Double Precision Float

General Double Precision Float

So when a computer divides seven by three, a lot of complex conversions between representations of these numbers goes on, a complex division process takes place and the result is not the real number 2.333333…. but an approximation, stored in the computer as a floating point number which only approximate, while still being actually quite accurate.

One third

One third

 

Advertisements
This entry was posted in Computing, General, Internet, Maths, Miscellaneous, Philosophy, Science, Society and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s