Haskell 98 - Standard Prelude - Floating Class
Fri, 19 Oct 2001 06:57:31 -0700
An apparently-innocuous suggestion about adding default methods for
sinh and cosh led to a flood of mail. Since no consensus emerged, I
plan to leave things as they are in the Haskell 98 Report. Namely,=20
the following default methods for the Floating class are there:
x**y =3D exp (log x * y)
logBase x y =3D log x / log y
sqrt x =3D x ** 0.5
tan x =3D sin x / cos x
tanh x =3D sinh x / cosh x
but there are no default methods for sinh, cosh.
If someone feels strongly that this is wrong, perhaps they could
try to form consensus among those who responded to the earlier
mail flurry (without bothering the list as a whole), and then put
a proposal. But I'm not a numerical expert, and the default method here
is definitely "no-op".
| -----Original Message-----
| From: George Russell [mailto:firstname.lastname@example.org]=20
| Sent: 15 October 2001 17:28
| To: email@example.com
| > | Also, I understand you are reluctant to make library changes,=3D20 =
| > |but sinh and cosh can easily be defined in terms of exp =3D20
| > | sinh x =3D3D (exp(x) - exp(-x))/2
| > | cosh x =3D3D (exp(x) + exp(-x))/2
| > | I suggest removing sinh and cosh from the minimal complete=3D20
| > | definition, and add the above defaults.
| > This looks pretty reasonable to me. We should have default methods=20
| > for anything we can.
| No. As has been pointed out, this is a bad idea numerically=20
| because it will give the wrong answer for sinh x for very=20
| small values of x. =20