The old round off problem?

sam samschul at pacbell.net
Sun Mar 5 01:01:11 EST 2006


David Treadwell wrote:
> 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
I tried the exp(x) equivalent of sinh(x) and cosh(x) with the same
results.
I think I will write my own or steal the Taylor(f(x),x,n) function in
both C++, and python.




More information about the Python-list mailing list