1 /* s_tanf.c -- float version of s_tan.c.
5 * ====================================================
6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 * Developed at SunPro, a Sun Microsystems, Inc. business.
9 * Permission to use, copy, modify, and distribute this
10 * software is freely granted, provided that this notice
12 * ====================================================
15 #if defined(LIBM_SCCS) && !defined(lint)
16 static char rcsid
[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $";
21 #include <math_private.h>
22 #include <libm-alias-float.h>
23 #include "s_sincosf.h"
25 /* Reduce range of X to a multiple of PI/2. The modulo result is between
26 -PI/4 and PI/4 and returned as a high part y[0] and a low part y[1].
27 The low bit in the return value indicates the first or 2nd half of tanf. */
29 rem_pio2f (float x
, float *y
)
33 const sincos_t
*p
= &__sincosf_table
[0];
35 if (__glibc_likely (abstop12 (x
) < abstop12 (120.0f
)))
36 dx
= reduce_fast (dx
, p
, &n
);
39 uint32_t xi
= asuint (x
);
42 dx
= reduce_large (xi
, &n
);
60 if(ix
<= 0x3f490fda) return __kernel_tanf(x
,z
,1);
62 /* tan(Inf or NaN) is NaN */
63 else if (ix
>=0x7f800000) {
69 /* argument reduction needed */
72 return __kernel_tanf(y
[0],y
[1],1-((n
&1)<<1)); /* 1 -- n even
76 libm_alias_float (__tan
, tan
)