]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/ieee754/dbl-64/s_sincos.c
ca44b9008f28c4ecea810521c42c42184c1aa42b
1 /* Compute sine and cosine of argument.
2 Copyright (C) 1997-2016 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
23 #include <math_private.h>
25 #define __sin __sin_local
26 #define __cos __cos_local
30 /* Consolidated version of reduce_and_compute in s_sin.c that does range
31 reduction only once and computes sin and cos together. */
34 reduce_and_compute_sincos (double x
, double *sinx
, double *cosx
)
37 unsigned int n
= __branred (x
, &a
, &da
);
55 *sinx
= bsloww (a
, da
, x
, n
);
57 *sinx
= bsloww1 (a
, da
, x
, n
);
58 *cosx
= bsloww2 (a
, da
, x
, n
);
62 __sincos (double x
, double *sinx
, double *cosx
)
67 SET_RESTORE_ROUND_53BIT (FE_TONEAREST
);
70 k
= 0x7fffffff & u
.i
[HIGH_HALF
];
74 *sinx
= __sin_local (x
);
75 *cosx
= __cos_local (x
);
81 int4 n
= reduce_sincos_1 (x
, &a
, &da
);
83 *sinx
= do_sincos_1 (a
, da
, x
, n
, false);
84 *cosx
= do_sincos_1 (a
, da
, x
, n
, true);
91 int4 n
= reduce_sincos_2 (x
, &a
, &da
);
93 *sinx
= do_sincos_2 (a
, da
, x
, n
, false);
94 *cosx
= do_sincos_2 (a
, da
, x
, n
, true);
100 reduce_and_compute_sincos (x
, sinx
, cosx
);
107 *sinx
= *cosx
= x
/ x
;
109 weak_alias (__sincos
, sincos
)
110 #ifdef NO_LONG_DOUBLE
111 strong_alias (__sincos
, __sincosl
)
112 weak_alias (__sincos
, sincosl
)