On Mon, Jul 17, 2000 at 17:51:27 +0200, Michael Marte wrote:
> When adding the three double numbers 
> 0.7, 0.2, and 0.1, a ghc 4.07-compiled program (compilation flag -O)
> yields 0.9999999999999999. Whatever this string stands for, the number is
> considered to be < 1.0, which breaks my program. What to do?

It's always been a problem to compare Floats. You can try

a) using Rationals (IIRC)
b) abs (x - 1.0) < threshold


Cheers,
Michael
-- 
() ASCII ribbon campaign |  Chair for Computer Science  II  | GPG: F65C68CD
/\ against HTML mail     |       RWTH Aachen, Germany       | PGP: 1D0DD0B9

       WWW: http://www-i2.informatik.rwth-aachen.de/Software/Haskell/

Reply via email to