-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
How about making default method for asin
asin x = atan(x/sqrt(1-x^2))
Can't be worse than the default for (**) ;-)
- --
Russell O'Connor[EMAIL PROTECTED]
http://www.math.berkeley.edu/~roconnor/
``This is not a
[EMAIL PROTECTED] wrote:
How about making default method for asin
asin x = atan(x/sqrt(1-x^2))
Can't be worse than the default for (**) ;-)
Oh, it can. As well as its own problems when x is close to 1, it
inherits, through the default definition of sqrt, the problems of (**)
when x
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,
the following default methods for the Floating class are there:
x**y = exp (log x
On Tuesday 16 October 2001 07:29, Fergus Henderson wrote:
[...]
The whole idea of letting you omit method definitions for methods with
no default and having calls to such methods be run-time errors is IMHO
exceedingly odd in a supposedly strongly typed language, and IMHO ought
to be
On Tuesday 16 October 2001 07:29, Fergus Henderson wrote:
[...]
The whole idea of letting you omit method definitions for methods with
no default and having calls to such methods be run-time errors is IMHO
exceedingly odd in a supposedly strongly typed language, and IMHO ought
to be
Hi!
Jon Fairbairn wrote:
I agree too, but being able to omit method definitions is
sometimes useful -- would it be possible to make calls to
those methods a /static/ error? I suspect this would be hard
to do.
Yes, quite tricky. The problem is that the class constraints (in an
inference
Thu, 18 Oct 2001 13:49:11 +0200, Karl-Filip Faxen [EMAIL PROTECTED] pisze:
There are two solutions that I can see: Annotate classes in class
constraints with exactly which methods were used. Thus for the
expression x+y the inference algorithm would record the constraint
Num{+} a if x and y
Tue, 16 Oct 2001 15:29:36 +1000, Fergus Henderson [EMAIL PROTECTED] pisze:
Not giving a default definition is *not* the same as giving a default
definition that calls error. It's significantly safer. The difference
is that the former makes it much easier for compilers to issue warnings
Fpr the Revised Haskell 98 report, Russell O'Connor suggests:
| Also, I understand you are reluctant to make library changes,
| but sinh and cosh can easily be defined in terms of exp
|
| sinh x = (exp(x) - exp(-x))/2
| cosh x = (exp(x) + exp(-x))/2
|
| (source: Calculus Third
Simon Peyton-Jones:
Russell O'Connor suggests:
| but sinh and cosh can easily be defined in terms of exp
|
| sinh x = (exp(x) - exp(-x))/2
| cosh x = (exp(x) + exp(-x))/2
| I suggest removing sinh and cosh from the minimal complete
| definition, and add the above defaults.
This
2. So, they hold for the Complex numbers as well. The gymnastics with
complex sinh and cosh seems to be redundant.
Well, I would be a little careful changing these. Some of the definitions
in numerical part of the Prelude look more convoluted than they need to
be, but it's because they have
| sinh x = (exp(x) - exp(-x))/2
| cosh x = (exp(x) + exp(-x))/2
...
This looks pretty reasonable to me. We should have default methods
for anything we can.
Why not provide defaults for the inverse functions as well?
asinh x = log (x + sqrt (1+x*x))
acosh x = log (x + (x+1) * sqrt
- Original Message -
From: Jerzy Karczmarczuk [EMAIL PROTECTED]
...
Simon Peyton-Jones:
Russell O'Connor suggests:
| but sinh and cosh can easily be defined in terms of exp
|
| sinh x = (exp(x) - exp(-x))/2
| cosh x = (exp(x) + exp(-x))/2
| I suggest removing sinh
| 1. Actually, I wouldn't even call that default
| definitions. These ARE
| definitions of sinh and cosh.
|
| Mathematically, yes. Numerically, no. Even if 'exp' is
| implemented with high accuracy, the suggested defaults may
| return a very inaccurate (in ulps) result. Take sinh near
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Mon, 15 Oct 2001, Lennart Augustsson wrote:
Why not provide defaults for the inverse functions as well?
asinh x = log (x + sqrt (1+x*x))
acosh x = log (x + (x+1) * sqrt ((x-1)/(x+1)))
atanh x = log ((x+1) / sqrt (1 - x*x))
That's a good idea too.
Is there a reason for defining acosh as above instead of
acosh x = log(x + sqrt(x*x-1))
If there is one I can't remember it. :-)
-- Lennart
___
Haskell mailing list
[EMAIL PROTECTED]
Simon PJ wrote:
Fpr the Revised Haskell 98 report, Russell O'Connor suggests:
=20
| Also, I understand you are reluctant to make library changes,=20
| but sinh and cosh can easily be defined in terms of exp
|=20
| sinh x =3D (exp(x) - exp(-x))/2
| cosh x =3D (exp(x) +
On Mon, Oct 15, 2001 at 06:27:52PM +0200, George Russell wrote:
Simon PJ wrote:
Fpr the Revised Haskell 98 report, Russell O'Connor suggests:
=20
| Also, I understand you are reluctant to make library changes,=20
| but sinh and cosh can easily be defined in terms of exp
Dylan Thurston wrote:
[snip]
No. As has been pointed out, this is a bad idea numerically because
it will give the wrong answer for sinh x for very small values of
x. As a matter of fact, you will also get the wrong answer for very large
values of x, where exp(x) can overflow even though
On 15-Oct-2001, Simon Peyton-Jones [EMAIL PROTECTED] wrote:
The proposal is only to give default declarations
in the class defn for sinh, cosh, and perhaps as Lennart suggests
asinh, acosh, atanh. They give a reasonable first cut if you
don't write definitions yourself. But you can
On Mon, Oct 15, 2001 at 03:52:06PM +0200, Kent Karlsson wrote:
Simon Peyton-Jones:
Russell O'Connor suggests:
| but sinh and cosh can easily be defined in terms of exp
| sinh x = (exp(x) - exp(-x))/2
| cosh x = (exp(x) + exp(-x))/2
...
This looks pretty reasonable to me. We
In general, this is why LIA-2 (Language Independent Arithmetic, part
2, Elementary numerical functions, ISO/IEC 10967-2:2001) [. . .]
This sounds like a very interesting standard. I am constantly annoyed
by ISO's attempts to hide their standards; one might wonder what the
purpose is of
22 matches
Mail list logo