[Haskell-cafe] Re: Is logBase right?

Eugene Kirpichov ekirpichov at gmail.com
Sun Aug 23 07:12:54 EDT 2009


2009/8/23 Steve <stevech1097 at yahoo.com.au>:
> 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
>

>>> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Eugene Kirpichov
Web IR developer, market.yandex.ru


More information about the Haskell-Cafe mailing list