2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 * Developed at SunPro, a Sun Microsystems, Inc. business.
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
9 * ====================================================
11 * s_sin.c and s_cos.c merged by Steven G. Kargl. Descriptions of the
12 * algorithms are contained in the original files.
15 #include <sys/cdefs.h>
19 #define INLINE_REM_PIO2
20 #include "math_private.h"
21 #include "e_rem_pio2.c"
25 sincos(double x, double *sn, double *cs)
35 if (ix <= 0x3fe921fb) {
36 if (ix < 0x3e400000) { /* |x| < 2**-27 */
37 if ((int)x == 0) { /* Generate inexact. */
43 __kernel_sincos(x, 0, 0, sn, cs);
47 /* If x = Inf or NaN, then sin(x) = NaN and cos(x) = NaN. */
48 if (ix >= 0x7ff00000) {
54 /* Argument reduction. */
55 n = __ieee754_rem_pio2(x, y);
59 __kernel_sincos(y[0], y[1], 1, sn, cs);
62 __kernel_sincos(y[0], y[1], 1, cs, sn);
66 __kernel_sincos(y[0], y[1], 1, sn, cs);
71 __kernel_sincos(y[0], y[1], 1, cs, sn);
76 #if (LDBL_MANT_DIG == 53)
77 __weak_reference(sincos, sincosl);