* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
* @(#)r_tan.c 5.3 11/3/86
SINGLE PRECISION floating point tangent
sin/cos is used after argument reduction to [0,pi/4] range.
since x is in this range, tan(x) is in [0,1] range and
no overflow can occur here.
static double invpi
= 1.27323954473516268; /* 4/pi */
fortran
float sin(), cos();
if(arg
< 0.){ /* tan(-arg) = -tan(arg) */
arg
= arg
*invpi
; /*overflow?*/
case 1: /* 2nd octant: tan(x) = 1/tan(1-x) */
case 2: /* 3rd octant: tan(x) = -1/tan(x) */
case 3: /* 4th octant: tan(x) = -tan(1-x) */
if(temp
== 0.) { /* check for singular "point" */