Bug in tanh? A solution, maybe for the GCL people?
Subject: Bug in tanh? A solution, maybe for the GCL people?
From: Richard Fateman
Date: Mon, 19 Mar 2007 11:56:10 -0700
> -----Original Message-----
> From: Raymond Toy [mailto:raymond.toy at ericsson.com]
> Sent: Monday, March 19, 2007 9:38 AM
7
>
> I think I wrote that (1987 is only 20 years ago)....
Actually, a relief, since I don't recall doing it...!
RJF
>
> Richard> ....
>
> Richard> We can compute d(x):= exp(x) - 1, but do it
> carefully to preserve precision
> Richard> when
> Richard> |x| is small. X is a FP number, and a FP number
> is returned.
>
> Richard> Then tanh is d(2*x)/(2+d(2*x))
>
> Yes, this would work, if you have an accurate d(x).
>
> Here is an alternative, based on Kahan's complex tanh, except modified
> to work with just real numbers. Simple tests near zero and for large
> x indicates this this works. Works on GCL too.
>
>
<snip>