[Haskell-cafe] Re: pi
Jonathan Cast
jonathanccast at fastmail.fm
Wed Oct 10 19:54:48 EDT 2007
On Wed, 2007-10-10 at 12:29 +0200, jerzy.karczmarczuk at info.unicaen.fr
wrote:
> ChrisK writes:
>
> > Putting 'pi' in the same class as the trigonometric functions is good design.
>
> If you wish so... But:
> Look, this is just a numeric constant.
> Would you like to have e, the Euler's constant, etc., as well, polluting
> the name space? What for?
>
> > Moving smoothly from single to double precision was much of the motivation to
> > invent a mechanism like type classes in the first place.
>
> Pardon?
> I think I remember the time when type classes have been introduced. The
> motivation you mention is not very visible, if at all... Actually, the
> numerical hierarchy was - as the French would say - "bricolée" with plenty
> of common sense, but without a decent methodology... The type classes is
> a splendid invention, much beyond any numerics.
> Besides, most people who *really* need FlP numerics use only the most
> precise available, the "single precision" stuff is becoming obsolete.
>
> > There are two things in Floating, the power function (**) [ and sqrt ] and the
> > transcendental functions (trig functions,exp and log, and constant pi).
> >
> > Floating could be spit into two classes, one for the power and one for the
> > transcendental functions.
>
> The power is an abomination for a mathematician. With rational exponent it
> may generate algebraic numbers, with any real - transcendental... The
> splitting should be more aggressive. It would be good to have *integer*
> powers, whose existence is subsumed by the multiplicative s.group structure.
> But the Haskell standard insists that the exponent must belong to the same
> type as the base...
Check out the type of (^). It's a different operator, but they exist...
jcc
More information about the Haskell-Cafe
mailing list