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>
16 __FBSDID("$FreeBSD$");
21 #define INLINE_REM_PIO2
22 #include "math_private.h"
23 #include "e_rem_pio2.c"
27 sincos(double x, double *sn, double *cs)
37 if (ix <= 0x3fe921fb) {
38 if (ix < 0x3e400000) { /* |x| < 2**-27 */
39 if ((int)x == 0) { /* Generate inexact. */
45 __kernel_sincos(x, 0, 0, sn, cs);
49 /* If x = Inf or NaN, then sin(x) = NaN and cos(x) = NaN. */
50 if (ix >= 0x7ff00000) {
56 /* Argument reduction. */
57 n = __ieee754_rem_pio2(x, y);
61 __kernel_sincos(y[0], y[1], 1, sn, cs);
64 __kernel_sincos(y[0], y[1], 1, cs, sn);
68 __kernel_sincos(y[0], y[1], 1, sn, cs);
73 __kernel_sincos(y[0], y[1], 1, cs, sn);
78 #if (LDBL_MANT_DIG == 53)
79 __weak_reference(sincos, sincosl);