Associated Topics || Dr. Math Home || Search Dr. Math

### Teaching Rounding Rules

```Date: 10/17/2002 at 03:20:01
From: Olof
Subject: The convention of always rounding .5 up

I've been teaching my son that when one rounds numbers like 3.5 or 4.5
to the nearest integer, one always rounds to the nearest even integer,
so that 3.5 should be rounded up, and 4.5 should be rounded down.
(Of course, 4.500001 gets rounded up to 5.)

This is what I was taught in college (and still seems to be the IEEE
standard).  However, every grade school textbook I find (as well as
the Dr. Math web page) says that one always rounds up.

Is there any good reason why grade-schoolers are taught to always
round up?
```

```
Date: 10/17/2002 at 09:36:08
From: Doctor Peterson
Subject: Re: The convention of always rounding .5 up

Hi, Olof.

Rounding Decimals: Even/Odd Issues
http://mathforum.org/library/drmath/view/58972.html

The rule taught to children is used because it is very simple,
requiring only looking at the next digit to see if it is 5 or more.
It arises in a simple way: since any number whose next digit is 5,
followed by something other than zero, definitely requires rounding
up, it is convenient to treat 4.5 the same as 4.51, 4.501, and so on.

Also, it is easy to implement this in programming:

round(x) = int(x+0.5)

so that round(4.5) = int(5.0) = 5.

I had not been aware that IEEE had a convention for rounding, so I
looked it up, and found that things are just a little more
complicated. It turns out that there are several "IEEE rounding
modes":

http://www.cs.nyu.edu/courses/spring02/V22.0480-002/mips-fpt.pdf

Rounding Modes
Round to nearest even
o This is the normal default mode
Round/truncate towards zero
Round down towards minus infinity
Round up towards plus infinity
o Last two can be used for interval arithmetic

Unbiased Rounding
Round to nearest exact number
For 0.5 case, round so that result is even
o Example for integers
o 2.5 rounds to 2
o 3.5 rounds to 4
This avoids bias in rounding

http://www.eng.tau.ac.il/~guy/Papers/dual_precision_FP_MUL.pdf

The IEEE Standard defines four rounding modes: round toward 0,
round toward [+infinity], round toward [-infinity], and round
to nearest. We deal with numbers that are represented in a
sign-magnitude representation. The rounding modes round toward
[+infinity] and round toward [-infinity] can be reduced, based
on the sign of the number, either to round toward zero (i.e.
truncate) or round to infinity (i.e. round up) [7]. We assume
henceforth that the number to be rounded is non-negative. We
focus on three rounding modes: RZ - round toward zero, RI -
round toward infinity, and RNE - round to nearest (even).

Following Quach et al., we implement RNE by RNU (round to
nearest up) followed by an adjustment of the LSB. RNU mode
differs from RNE mode only when the exact result is in the
midpoint between two successive representable values; in this
case RNE rounds to the representable value with the zero LSB
and RNU rounds to the larger representable value. A
discrepancy between RNE and RNU can occur only if the LSB in
RNU is 1, in which case pulling down the LSB to zero results
with the RNE result.

So RNE is the default mode; RNU would be what we teach children, and
is not supported by IEEE. Of course, IEEE rounding applies to binary,
not to decimal digits.

I've learned something new!

Here is an additional site I that shows how the Pentium implements the
optional modes supported by the standard; search for "rounding" within
the page:

http://www.intel.com/design/intarch/techinfo/pentium/fpu.htm

If you have any further questions, feel free to write back.

- Doctor Peterson, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 08/25/2003 at 20:33:28
From: Edward
Subject: Rounding numbers, IEEE vs. standard accounting practice

Many programming languages have incorporated the IEEE 754 standard
for rounding. This standard causes the following: 2.5 is rounded to
2 instead of 3, and -123.9 is rounded to -123 instead of -124. Both
of these do not conform to what I consider standard accounting
practice. My question is: Where can I find a definition of how
rounding should be performed in accounting?

There is considerable documantation on the IEEE standard. However I
cannot find any supporting documntation on what I have been
programming for 42 years regarding rounding.

I only discovered the IEEE standard a few weeks ago, and it has
```

```
Date: 08/26/2003 at 09:51:35
From: Doctor Peterson
Subject: Re: Rounding numbers, IEEE vs. standard accounting practice

Hi, Edward.

I'm not sure whether what you are saying is true. As I understand it,
first, the IEEE standard for rounding is (normally, but not
universally) to round to the nearest even number; but, second, that
standard applies to internal rounding of floating point results to
get the last bit in binary, not to rounding floating point to
integer, which is language-dependent. Many languages do not even have
a built-in rounding construct, but simply truncate when converting
float to int (as in C). If you want to round, you would use a
function dedicated to rounding by whatever definition you choose. It
is popular to round by the "round up at 5" rule, because that is easy
to program (by adding 0.5 and truncating); but for statistical
purposes, one can write a function that rounds to the nearest even
number, and I would expect statistical packages to do so.

As you can see from my answer to Olof, I am not an expert in IEEE
standards, so if you have details that would correct my understanding,

For accounting, you will want to look for accounting standards, not
mathematical or computing standards. I could easily imagine practical
rules such as always rounding down prices charged but rounding up
taxes owed, or something like that; there are other considerations
besides statistical errors in play where money in concerned. But I

I did find this discussion, which is apparently your own question:

http://www.computing.net/programming/wwwboard/forum/7602.html

I see you didn't come to a conclusion about accounting practice, and
that there are no official rules on this matter. If you ever do find
a clear definition of rounding from an accounting standards

- Doctor Peterson, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 08/26/2003 at 17:04:41
From: Doctor Peterson
Subject: Re: Rounding numbers, IEEE vs. standard accounting practice

that your use of Basic may be influencing your perception of the

First, as I said, the IEEE standard does not force languages to round-
to-nearest-even when they convert floating point to integer; that
policy is language-dependent. Looking first at the help for VB, I
find this:

Each function coerces an expression to a specific data type.
...
The required expression argument is any string expression or
numeric expression.

Function  Return Type  Range for expression argument
...
CInt      Integer      -32,768 to 32,767; fractions are rounded.
CLng      Long         -2,147,483,648 to 2,147,483,647; fractions
are rounded.
...
When the fractional part is exactly 0.5, CInt and CLng always
round it to the nearest even number. For example, 0.5 rounds to 0,
and 1.5 rounds to 2. CInt and CLng differ from the Fix and Int
functions, which truncate, rather than round, the fractional part
of a number. Also, Fix and Int always return a value of the same
type as is passed in.

So the issue here is not that IEEE requires this type of rounding (or
any rounding); it is simply that Microsoft chose to define the Int
function as truncating, the CInt function as rounding to nearest
even, and, as far as I can see, provide no function to round using
what you and I consider the "basic", normal method. The Round
function does exactly what CInt does (when rounding to an integer).

Now, in C, conversion always means truncation; here is VC's
explanation:

Floating to Integral

When an object of floating type is converted to an integral type,
the fractional part is truncated. No rounding takes place in the
conversion process. Truncation means that a number like 1.3 is
converted to 1, and –1.3 is converted to –1.

I tested Basic and found that although Int truncates, as C does, it
always truncates toward -infinity (that is, -1.3 is truncated to -2)
rather than toward zero as C does. So C allows you to round the way
you want to more easily than VB does. But the Basic function you gave
is just right; define that as a function in all your projects and you
have what you want. Why Microsoft doesn't provide it for you, I can't
guess.

This doesn't help at all with your real issue, of course. I suspect
that accounting organizations don't know about the statisticians'
preferred way to round, or about IEEE, and just assume that everyone
rounds the way they were taught in school (though we get questions
from people who say they learned round-to-nearest-even in school, and
are surprised at what their children are taught). But it's worth
knowing that the computing industry is not deliberately messing up
accountants' work. (Well, maybe Microsoft is ...)

- Doctor Peterson, The Math Forum
http://mathforum.org/dr.math/
```

```
Date: 08/27/2003 at 17:08:15
From: Doctor Peterson
Subject: Re: Rounding numbers, IEEE vs. standard accounting practice

Hi, Edward.

I have continued to search for information, because I would expect
the accounting or financial industry to pay careful attention to
rules such as those for rounding. Also, the fact that some parents
have thought that the round-up-on-5 rule that we teach is incorrect,
having learned the round-to-nearest-even-on-5 method in school, makes
it important to me to find out who actually uses each rule. We all
seem to think that what we learned in school is normal, but both
methods seem to be taught in different schools, and there really is
no "normal".

Here is the best I have found. First, there are clear rules for
conversion of European currency:

What are the Euro ROUNDING Rules?
http://home.clara.net/odonoghue/qa2-3.htm

ARTICLE 5

Monetary amounts to be paid or accounted for, when a rounding
takes place after a conversion into the euro unit according to
article 4, shall be rounded up or down to the nearest cent.

Monetary amounts to be paid or accounted for which are converted
into a national currency unit shall be rounded up or down to the
nearest sub-unit, or in the absence of a sub-unit to the nearest
unit or according to national law or practice to a multiple or
fraction of the sub-unit or unit of the national currency unit.

If the application of the conversion rates gives a result that
is exactly halfway, the sum shall be rounded up.

There will be a fixed conversion rate between the Euro and each
participating currency and this will be expressed to six
significant figures (note not decimal places).

That shows that there is at least one financial area where round-up-
on-5 is explicitly required.

The next page shows a large number of possible rounding rules, and,
along with many others I've found, refers to the "nearest-even" rule
as Bankers' Rounding, which turns the issue on its head:

Pascal/Delphi Rounding and Truncation.
http://www.merlyn.demon.co.uk/pas-chop.htm

Some of the pages I found while searching for this phrase explicitly
claim that it is standard in accounting. As far as I can see, though,
only programmers call it that, not bankers, so I have no absolute
evidence that bankers actually round this way!

Here is one of the more explicit statements (though still from
programmers rather than from bankers) that it is indeed done:

Rounding in Excel
http://www.rmgsoftware.com/xl/xl063.htm

instances.   Assume that you want to round the value 7.5 to zero
decimal places.   The ROUND function would return the value 8.
If you wanted to round the value 6.5 to zero decimal places, the
ROUND function would return the value 7.   In other words, when
the value to be rounded is exactly midway between two values,
Excel always rounds away from zero.   You can demonstrate this
by rounding the values -7.5 and -6.5 to zero decimal places.
In this case, the ROUND function returns -8 and -7 respectively.

This can cause problems if you use the ROUND function extensively
on a worksheet, particularly in a statistical or analytical
situation.   A more common approach to this problem, particularly
in the banking industry, is to round to the nearest even
number.   In the above examples, 7.5 would be rounded up to 8,
while 6.5 would be rounded down to 6.   This practice would at
least ensure that rounding differences are minimised.

(Note that that page faces the opposite of your problem: In Excel,
only the rounding you prefer is supported, and they want to find a
way to implement round-to-even!)

The next, from IBM, makes a more specific claim:

Decimal Arithmetic FAQ
http://www2.hursley.ibm.com/decimal/decifaq1.html#rounding

What rounding modes are needed for decimal arithmetic?

The three most important are

round-half-even, where a number is rounded to the nearest
digit, and if it is half-way between two values then it is
rounded to the nearest even digit. This method ensures that
rounding errors cancel out (on average), and is sometimes
called “Banker’s rounding”. For example, 12.345 rounded to
four digits is 12.34 and 12.355 rounded to four digits is
12.36.

round-half-up, where a number is rounded to the nearest digit,
and if it is half-way between two values then it is rounded to
the digit above. Here, 12.345 rounded to four digits is 12.35
and 12.355 rounded to four digits is 12.36.

round-down, where a number is truncated (rounded towards zero).

The first of these is commonly used for mathematical applications
and for financial applications (other than tax calculations) in
most states of the USA. The second is used for general
arithmetic, for financial applications in the UK and Europe, and
for tax applications in the USA. The third is used for both tax
and other calculations, world-wide.

This sounds like the most authoritative statement yet, and it tells
us that the accounting industry is mixed up in its use of rounding,
just like the rest of the world. I suspect this will not fully
satisfy you, but it may be the best we'll get.

- Doctor Peterson, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Calculators, Computers