Re: [Haskell-cafe] Error with Float

So there's no way to get exact stream that represents a fraction, such as: .5 = .10000000000000000.... .2 = .00110011001100110011............ ???
From: Udo Stenzel
To: Dinh Tien Tuan Anh Subject: Re: [Haskell-cafe] Error with Float Date: Tue, 19 Jul 2005 20:51:14 +0200 Value is: 0.800000000000001
What did you expect? Floating point numbers are inexact by their very nature. Since 0.8, like many other numbers, is not representable exactly in binary, (10 * 0.8 - 8) will certainly not be zero.
Take a course in numerical mathematics some time. It helps.
Udo. -- HTML needs a <rant> tag. -- Alan Cox << signature.asc >>
_________________________________________________________________ It's fast, it's easy and it's free. Get MSN Messenger 7.0 today! http://messenger.msn.co.uk
participants (1)
-
Dinh Tien Tuan Anh