
Hi, Floating point numbers are just inaccurate, so the results you see aren't too surprisingly. Interestingly enough, using Hugs, I get the right answer in both cases - so its possible it's a bug, but unlikely. If you do want exact floating point manipulation then use rational numbers instead, for example:
3.0 * 0.2 :: Rational 3%5
Which should be read as a fraction, 3/5, which is the right answer. Thanks Neil
-----Original Message----- From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On Behalf Of José Pedro Correia Sent: 14 November 2008 2:33 pm To: glasgow-haskell-users@haskell.org Subject: Re: Bug in GHC6.10.1?
Hello
I was wondering if there is a bug in GHC 6.10.1 regarding number precision.
As an example, in GHCi with:
3.0 * 0.2
I get: 0.6000000000000001
Although:
2.0 * 0.2 0.4
I have GHC 6.10.1 on Mac OS X 10.5.
Is this a known bug or should I report it?
Best regards Zé Pedro _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ==============================================================================