floating point arithmetic

Ross Paterson ross@soi.city.ac.uk
Fri, 27 Sep 2002 11:55:16 +0100


On Fri, Sep 27, 2002 at 12:53:01PM +0200, Juan Manuel Urbano Blanco wrote:
> Hi, I inform you of the following bug:
> 
> Prelude> (4.72*25)
> 118.0
> Prelude> floor (4.72*25)
> 117

Prelude> 4.72*25 - 118
-7.62939e-06
Prelude> round (4.72*25::Rational)
118

Not a bug, just the old problem that Double can't precisely represent
decimal fractions (made a bit worse in Hugs because it's the same as Float).