Displaying 2 results from an estimated 2 matches for "r_ctanh".
Did you mean:
ctanh
2017 Mar 17
4
Hyperbolic tangent different results on Windows and Mac
Dear all,
We seem to have found a "strange" behaviour in the hyperbolic tangent
function tanh on Windows.
When running tanh(356 + 0i) the Windows result is NaN + 0.i while on Mac
the result is 1 + 0i. It doesn't seem to be a floating point error because
on Mac it is possible to run arbitrarily large numbers (say tanh(
2017 Mar 21
0
Hyperbolic tangent different results on Windows and Mac
...still present there: In yesterday's version of R-devel, tanh(500+0i) still returns NaN+0i.
I now think a better solution would be to use R's internal
substitute (in R's src/main/complex.c): There, we have
------------------------------------------------
#ifndef HAVE_CTANH
#define ctanh R_ctanh
static double complex ctanh(double complex z)
{
return -I * ctan(z * I); /* A&S 4.5.9 */
}
#endif
------------------------------------------------
and we should use it (by "#undef HAVE_CTAN" (or better by a
configure check, using ctanh("500 + 0i"),...