Is there any system that doesn't have cosh/atanh/asinh etc?
And/or does anyone object of having them in _math (and therefore in the global namespace)?
Probably. But they are simple enough to emulate.
sinh(x) = 0.5*(exp(x)-exp(-x)) cosh(x) = 0.5*(exp(x)+exp(-x)) tanh(x) = (exp(x)-exp(-x))/(exp(x)+exp(-x)) asinh(x) = log(x+sqrt(1+x*x)) acosh(x) = 2*log(sqrt(0.5*(x+1))+sqrt(0.5*(x-1))) atanh(x) = 0.5*(log(1+x)-log(1-x))
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-07-17 18:36: Subject: cosh, atanh, sinh
Is there any system that doesn't have cosh/atanh/asinh etc?
And/or does anyone object of having them in _math (and therefore in the global namespace)?
/ Mirar
I'll check in my changes to _math and lets see if xenofarm screams.
/ Mirar
Previous text:
2003-07-17 18:50: Subject: cosh, atanh, sinh
Probably. But they are simple enough to emulate.
sinh(x) = 0.5*(exp(x)-exp(-x)) cosh(x) = 0.5*(exp(x)+exp(-x)) tanh(x) = (exp(x)-exp(-x))/(exp(x)+exp(-x)) asinh(x) = log(x+sqrt(1+x*x)) acosh(x) = 2*log(sqrt(0.5*(x+1))+sqrt(0.5*(x-1))) atanh(x) = 0.5*(log(1+x)-log(1-x))
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
What do you mean by "f should be specified in radians"? The hyperbolic functions don't deal with angles.
Also, shouldn't the parameter to ARG_CHECK be the name of the function? (Right now, the "h" is missing in all the functions.)
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-07-17 18:51: Subject: cosh, atanh, sinh
I'll check in my changes to _math and lets see if xenofarm screams.
/ Mirar
Ah. Miss.
/ Mirar
Previous text:
2003-07-17 19:03: Subject: cosh, atanh, sinh
What do you mean by "f should be specified in radians"? The hyperbolic functions don't deal with angles.
Also, shouldn't the parameter to ARG_CHECK be the name of the function? (Right now, the "h" is missing in all the functions.)
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Hm. I just wondered about that.
/ Mirar
Previous text:
2003-07-17 19:10: Subject: cosh, atanh, sinh
You should remove the "Impossible tangent" check in tanh as well, tanh is defined for the entire real axis (and quite possibly the complex plane as well :).
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
They don't seem to work very well. I wonder if I missed anything, or if it's glibc.
float x=1.55; 0.5*(exp(x)+exp(-x));
(3) Result: 2.461859
cosh(x);
(4) Result: inf
A tiny C-only test program yields the same result. I think I'll move on from system to your functions.
/ Mirar
Previous text:
2003-07-17 18:50: Subject: cosh, atanh, sinh
Probably. But they are simple enough to emulate.
sinh(x) = 0.5*(exp(x)-exp(-x)) cosh(x) = 0.5*(exp(x)+exp(-x)) tanh(x) = (exp(x)-exp(-x))/(exp(x)+exp(-x)) asinh(x) = log(x+sqrt(1+x*x)) acosh(x) = 2*log(sqrt(0.5*(x+1))+sqrt(0.5*(x-1))) atanh(x) = 0.5*(log(1+x)-log(1-x))
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
2.461859078 is the correct value according to my Casio calculator.
I expect it's a glibc bug, so maybe it's better to use the "emulation" functions, yes.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-07-17 19:54: Subject: cosh, atanh, sinh
They don't seem to work very well. I wonder if I missed anything, or if it's glibc.
float x=1.55; 0.5*(exp(x)+exp(-x));
(3) Result: 2.461859
cosh(x);
(4) Result: inf
A tiny C-only test program yields the same result. I think I'll move on from system to your functions.
/ Mirar
Since you have a calculator, would you feel like adding some tests for them for the testsuite?
/ Mirar
Previous text:
2003-07-17 20:23: Subject: cosh, atanh, sinh
2.461859078 is the correct value according to my Casio calculator.
I expect it's a glibc bug, so maybe it's better to use the "emulation" functions, yes.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
By the way, I found some glibc mailing list thread discussing "asm constraints" and cosh. *fear*
/ Mirar
Previous text:
2003-07-17 20:23: Subject: cosh, atanh, sinh
2.461859078 is the correct value according to my Casio calculator.
I expect it's a glibc bug, so maybe it's better to use the "emulation" functions, yes.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
pike-devel@lists.lysator.liu.se