Hi Eike,

Merry Christmas and a happy New Year to you.

Eike Rathke schrieb:
Hi Regina,

On Wednesday, 2008-12-17 16:22:09 +0100, Regina Henschel wrote:

Mathematically FISHER(x)=atanh(x). But the OOo function ATANH() uses the same insufficient algorithm as FISHER. Therefore ATANH() has to be changed too. The best solution, using a build-in function, is not available: atanh() is a C99 function and therefore not available in MSVC compiler. The code itself is rather simple, there are two possible methods:
(1) atanh(x)=0.5*log1p(2*x/(1-x))
(2) Use the first five summands of the power series for |x|<0.01, which would be atanh(x)=x(1+x²*(1/3+x²*(1/5+x²*(1/7+x²*1/9)))) and use atanh(x)=0.5*ln((1+x)/(1-x)) in the other cases.

I trust you that the results would be identical ;-)

In general they are, but to test, which cut value to use and how many summands are needed, is tedious. If there will be a reason for to make the solution independed of log1p, the algorithm can be changed.

  I think #1
would be best, for simplicity.

I have used (1)

 You could also profile some ten thousand
calls or so with a sample range of values to determine if any of the two
approaches would have significant performance benefits over the other.

I found no difference in performance.


1. Should atanh be implemented to ::rtl::math like it has been done for log1p and expm1?

Yes, that would be cleanest. Please file an issue similar to i97091

It is issue 97467. Although I do not really understand the things you have done for expm1 and log1p, I have tried to mimic them. Perhaps when code freeze is over, you have some time to explain it?

The related changes for ATANH, FISHER and FISHERINV are in issue 97468.

A quick look at ASINH shows, that it has similar deficiencies. But that will be a new project.

kind regards
Regina


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@sc.openoffice.org
For additional commands, e-mail: dev-h...@sc.openoffice.org

Reply via email to