[Haskell-cafe] Error with Float

Dinh Tien Tuan Anh tuananhbirm at hotmail.com
Tue Jul 19 16:13:27 EDT 2005


So there's no way to get exact stream that represents a fraction, such as:
.5 = .10000000000000000....
.2 = .00110011001100110011............


???


>From: Udo Stenzel <u.stenzel at web.de>
>To: Dinh Tien Tuan Anh <tuananhbirm at hotmail.com>
>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



More information about the Haskell-Cafe mailing list