Full_Name: Peter Fortini Version: 2.0.1 OS: Windows 2000 Submission from: (NULL) (65.246.187.164)
When the imaginary part of the argument is very large, the complex tangent function returns 0+NaNi. For example, tan(1+1000i)=0+NaNi; it should be 0+1i Easy to fix in complex.c, as the original NaN came from division of sinh and cosh that had reached machine infinity. static void z_tan(Rcomplex *r, Rcomplex *z) { double x2, y2, den; x2 = 2.0 * z->r; y2 = 2.0 * z->i; den = cos(x2) + cosh(y2); r->r = sin(x2)/den; /* any limit above about log(DBL_EPSILON) will do */ if (fabs(r->i) < 40.0) r->i = sinh(y2)/den; else r->i = 1.0; } ______________________________________________ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel