[Haskell-cafe] Default implementation of Floating (**)

Fabrício Olivetti de França fabricio.olivetti at gmail.com
Wed May 19 15:32:55 UTC 2021


nevermind, I was thinking of integer exponents. I should be using (^^) instead.

Thank you all.

Best,
Fabricio Olivetti de França

On Wed, May 19, 2021 at 12:29 PM Henning Thielemann
<lemming at henning-thielemann.de> wrote:
>
>
> On Wed, 19 May 2021, Viktor Dukhovni wrote:
>
> > On Wed, May 19, 2021 at 11:50:22AM -0300, Fabrício Olivetti de França wrote:
> >
> >> So I was wondering, is there any reason to have this (potentially
> >> dangerous) default implementation on base?
> >
> > The behaviour for negative inputs seems to be correct:
> >
> >    λ> log(-2)
> >    NaN
> >    λ> exp(log(-2))
> >    NaN
> >    λ> exp(log(-2) * (-2))
> >    NaN
> >    λ> log(0)
> >    -Infinity
> >
> > were you expecting these to check for non-positive inputs and to throw a
> > floating point exception?
>
>
> I guess he expects (-2)**(-2) = 1/4.
>
> But defined this way, (**) would be rather discontinuous._______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.


More information about the Haskell-Cafe mailing list