[racket] Decimal rounding problem

From: Pierpaolo Bernardi (olopierpa at gmail.com)
Date: Thu Nov 29 11:00:51 EST 2012

On Thu, Nov 29, 2012 at 4:48 PM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> But why does 3.225 round differently than 4.225?

Neither 3.225 nor 4.225 can be represented exactly in binary floating-point.

The numbers actually parsed are:

> (write-rational-expansion (inexact->exact 4.225))
4.2249999999999996447286321199499070644378662109375(0)
> (write-rational-expansion (inexact->exact 3.225))
3.225000000000000088817841970012523233890533447265625(0)

Posted on the users mailing list.