[Rd] complex tangent (PR#7781)

Thomas Lumley tlumley at u.washington.edu
Fri Apr 8 00:16:32 CEST 2005


On Thu, 7 Apr 2005 pfortini at wyeth.com wrote:
>
> 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)

You need z->i (or y2) here, r->i hasn't been initialized yet. Otherwise, 
yes.


 	-thomas



More information about the R-devel mailing list