The old round off problem?

David Treadwell i.failed.turing.test at gmail.com
Sat Mar 4 23:01:36 EST 2006


I wish I knew!

So I asked Google. Here's what I learned:

Most implementations are based on, or similar to the implementation  
in the fdlibm package.

sinh(x) and cosh(x) are both based on exp(x). See http:// 
www.netlib.org/cgi-bin/netlibfiles.pl?filename=/fdlibm/e_sinh.c

exp(x) is implemented by:

1.  reducing x into the range |r| <=  0.5 * ln(2), such that x = k *  
ln(2) + r
2.  approximating exp(r) with a fifth-order polynomial,
3.  re-scaling by multiplying by 2^k: exp(x) = 2^k * exp(r)

sinh(x) is mathematically ( exp(x) - exp(-x) )/2 but it's not  
calculated directly that way.

My brain hurts at this point; it's late. I'll have another go at  
hunting down the errors tomorrow. In the interim, does anybody out  
there already know the answer?

:--David

On Mar 4, 2006, at 8:27 PM, sam wrote:

> David I beg I beg
> Can you answer the question?
>
> Also thanks for the information on using the Taylor series.
>
> Sam Schulenburg
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list