# [racket] Decimal rounding problem

As 4.225 is inexact, it may be somewhat smaller that #e4.225 or somewhat
greater than #e4.225. Therefore, whether rounding an inexact number very
close to the edge of the rounding point goes up or down, seems irrelevant to
me. BTW, explicit rounding normally is the last operation in an inexact
calculation. Implicit rounding as in a basic operation (+, -, *, /) with
inexact numbers does occur, of course, and here rounding even up and odd
down (or reversely, I don't recall) may be usefull such as to have implicit
roundings cancel each other as much as possible, though I imagine their are
examples of calculations where this strategy accumulates inaccuracy rather
than reducing it.
Just some thoughts,
Jos
-----Original Message-----
From: users-bounces at racket-lang.org [mailto:users-bounces at racket-lang.org]
On Behalf Of Pierpaolo Bernardi
Sent: viernes, 30 de noviembre de 2012 10:02
To: Neil Toronto
Cc: users at racket-lang.org
Subject: Re: [racket] Decimal rounding problem
On Thu, Nov 29, 2012 at 7:42 PM, Neil Toronto <neil.toronto at gmail.com>
wrote:
>* On 11/29/2012 10:53 AM, Greg Graham wrote:
*
>>* Now, the unanswered question is why do Crystal Reports and Excel round
*>>* 4.225 to 4.23? I don't think I'll find as helpful of a forum to answer
*that
>>* question as I have found for Racket. Thanks again for being such a great
*>>* community!
*>*
*>* Aw, you buttered us up so nicely that I have to respond. They're probably
*>* rounding twice: once to get a decimal number close to the original, and
*then
>* to the specified number of digits.
*
Looks like that's it. This paper by William Kahan contains a nice
example of the problems of excel rounding:
http://www.cs.berkeley.edu/~wkahan/Mindless.pdf
(the paper is long, the excel example is on page 3)
P.
____________________
Racket Users list:
http://lists.racket-lang.org/users