Add 'e' to Floating typeclass

Yitzchak Gale gale at sefer.org
Wed Feb 20 13:30:07 UTC 2019


Lennart's question "Is it really worth it?" is the most important one.
And no, probably it isn't.

But Chessai is correct that this is a weird asymmetry in the Floating
class. My own experience is that I user neither e nor pi very much,
but neither one more than the other.

Branch cuts of inverse trig functions are not relevant. The report
doesn't explicitly state this, but it's clear that these functions are
expected to return the standard ranges of values as in other
programming languages. You can be quite certain that acos (-1) is pi
in Haskell. And in fact, we have (at least on my computer)

Prelude> acos (-1) == pi
True

So there isn't any more or less reason to have e than pi as a separate
class member.

On Sun, Feb 17, 2019 at 10:15 PM Lennart Augustsson
<lennart at augustsson.net> wrote:
>
> Is it really worth it?  How frequent are uses of e, except used like exp?  On the other hand, pi has more frequent standalone use cases.
> Also, e has a simple definition (exp 1), whereas pi is somewhat more involved.
>
> The logp1 and expm1 functions where added for good numerical reasons.  The same would not be true for e.
>
> On Sat, Feb 16, 2019 at 21:14 chessai . <chessai1996 at gmail.com> wrote:
>>
>> We have the 'pi' constant in the floating typeclass and some trigonometric functions, as well as things like exp/log/expm1/log1p.
>>
>> Why not provide an 'e' constant?
>>
>> A default implementation could just be 'exp 1'.
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


More information about the Libraries mailing list