[Haskell-cafe] Default implementation of Floating (**)
lemming at henning-thielemann.de
Wed May 19 15:24:55 UTC 2021
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)
> λ> exp(log(-2))
> λ> exp(log(-2) * (-2))
> λ> log(0)
> 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.
More information about the Haskell-Cafe