[Haskell-cafe] Re: Is logBase right?
Steve
stevech1097 at yahoo.com.au
Sun Aug 23 06:41:36 EDT 2009
On Sat, 2009-08-22 at 13:03 -0400, haskell-cafe-request at haskell.org
wrote:
> Message: 10
> Date: Sat, 22 Aug 2009 11:24:21 +0200
> From: Roberto L?pez <plastermoso at hotmail.com>
> Subject: [Haskell-cafe] Re: Is logBase right?
> To: haskell-cafe at haskell.org
> Message-ID: <h6odg8$93j$1 at 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
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.
Steve
More information about the Haskell-Cafe
mailing list