Re: floating point arithmetic

Ross Paterson <[email protected]>
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
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).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.