So you're using expm1 & log1p as the basic primitives, instead of exp & log? sinh(x) = (expm1(x)-expm1(-x))/2 cosh(x) = 1+(expm1(x)+expm1(-x))/2 asinh(x) = (log1p(x/sqrt(1+x^2))-log1p(-x/sqrt(1+x^2)))/2 atanh(x) = (log1p(x)-log1p(-x))/2 At 12:04 PM 8/11/2008, rcs@xmission.com wrote:
The bit patterns for "cosh" are slightly wrong. 2 + 1/2 => 10.1 I lean toward keeping the /2 in the definitions: This lets you view it as a rescaling of the argument, much like exp() vs 2^(). And all the identities that don't depend on the numerics of the argument still work: sinh+cosh, cosh^2-sinh^2, sinh(a+b), etc. If you drop the /2, then all these will acquire fudge factors.
Rich
----------- Quoting Henry Baker <hbaker1@pipeline.com>:
An interesting choice for a binary sinh & asinh would be 2^x-2^(-x) [define as sinh2(x)?] and its inverse.
Look at the bit patterns for 2^n-2^(-n) for n a positive integer:
n bit pattern 0 0.0 1 01.10 2 011.110 3 0111.1110 etc.
The "area" under the pulse/curve is 2*n. Perhaps a slightly different number representation would enable (2^n-2^(-n))/2 to work better, and to have an "area" of 1*n. Since multiplication acts like convolution, (sinh2(x))^n for large n should approach a normal distribution.
The bit patterns for an analogous cosh2(n)=2^n+2^(-n) are
n bit pattern 0 10.00 1 01.10 2 010.010 3 0100.0010 4 01000.00010
Once again, a slightly different number representation would enable (2^n+2^(-n))/2 to look prettier. (cosh2(x))^n should generate Pascal's triangle.
At 11:18 PM 8/3/2008, Joerg Arndt wrote:
* Mike Speciner <ms@alum.mit.edu> [Aug 03. 2008 21:08]:
Thanks for the pointer. I see that these functions are now called expm1 and log1p, and are available in many (but sadly not all) math libraries and languages, and people know enough to complain when they're not present. Were I still writing PostScript clones, I'd make sure to include them, even though it wouldn't be quite Adobe compatible.
--ms
[...]
Seems at least ISO C99 (and new versions of XOPEN) require that: from the man pages:
expm1(), expm1f(), expm1l(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE; or cc -std=c99
very same for log1p()