2009/8/23 Steve <stevech1...@yahoo.com.au>: > On Sat, 2009-08-22 at 13:03 -0400, haskell-cafe-requ...@haskell.org > wrote: >> Message: 10 >> Date: Sat, 22 Aug 2009 11:24:21 +0200 >> From: Roberto L?pez <plasterm...@hotmail.com> >> Subject: [Haskell-cafe] Re: Is logBase right? >> To: haskell-cafe@haskell.org >> Message-ID: <h6odg8$93...@ger.gmane.org> >> Content-Type: text/plain; charset="ISO-8859-1" >> >> If 4.0 / 2.0 was 1.9999999999999999999998, it would be ok? >> >> The real value of log10 1000 is 3 (3.0). It can be represented with >> accuracy >> and it should be. >> >> You get the accuracy value in Perl, but there is the same problem in >> Python. >> It's a bit discouraging. >> > > There is *not* the same problem in Python: > $ python > Python 2.6.2 (r262:71600, Jul 9 2009, 23:16:53) > [GCC 4.4.0 20090506 (Red Hat 4.4.0-4)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import math >>>> math.log10(1000) > 3.0 >
>>> import math >>> math.log(1000,10) 2.9999999999999996 > Recent work in Python 3 (and Python 2.6) has improved the handling of > floating point numbers, and addresses exactly the problem that Roberto > has raised. > > I see no reason why Haskell could not improve its handling of floating > point numbers by using similar techniques. You mean introducing a "log10" function into the definition of the Floating class ? That might be a proposal for Haskell Prime. > > Steve > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Eugene Kirpichov Web IR developer, market.yandex.ru _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe