[racket] Decimal rounding problem

From: Jos Koot (jos.koot at gmail.com)
Date: Fri Nov 30 14:55:05 EST 2012

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, 

-----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>
> 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
>> 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
> 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:


(the paper is long, the excel example is on page 3)

  Racket Users list:

Posted on the users mailing list.