[Haskell-cafe] Re: pi
Henning Thielemann
lemming at henning-thielemann.de
Wed Oct 10 16:32:55 EDT 2007
On Wed, 10 Oct 2007, David Roundy wrote:
> On Wed, Oct 10, 2007 at 08:53:22PM +0200, Henning Thielemann wrote:
>> On Wed, 10 Oct 2007, David Roundy wrote:
>>> It seems that you're arguing that (**) is placed in the correct class,
>>> since it's with the transcendental functions, and is implemented in terms
>>> of those transcendental functions. Where is the abomination here?
>>
>> (**) should not exist, because there is no sensible definition for many
>> operands for real numbers, and it becomes even worse for complex numbers.
>> The more general the exponent, the more restricted is the basis and vice
>> versa in order to get sound definitions.
>
> Would you also prefer to eliminate sqrt and log?
No, why?
> We've been using these functions for years (in other languages) without
> difficulty, and I don't see why this has changed.
You mentioned these functions - not me.
> I think it's quite sensible, for instance, that passing a negative
> number as the first argument of (**) with the second argument
> non-integer leads to a NaN.
It would better to disallow negative bases completely for (**), because
integers should be explicitly typed as integers and then (^^) can be used.
I have already seen (x**2) and (e ** x) with (e = exp 1) in a Haskell
library. Even better would be support for statically checked non-negative
numbers.
More information about the Haskell-Cafe
mailing list