mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 13:30:06 +00:00
4ebd120cd9
http://sourceware.org/ml/libc-alpha/2013-08/msg00082.html This patch replaces occurrences of GET_LDOUBLE_* and SET_LDOUBLE_* macros, and union ieee854_long_double_shape_type in ldbl-128ibm/, and a stray one in the 32-bit fpu support. These files have no significant changes apart from rewriting the long double bit access. * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_high): Define. * sysdeps/ieee754/ldbl-128ibm/e_acoshl.c (__ieee754_acoshl): Rewrite all uses of ieee854 long double macros and unions. * sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_atanhl.c (__ieee754_atanhl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_coshl.c (__ieee754_coshl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_log2l.c (__ieee754_log2l): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c (__ieee754_rem_pio2l): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_sinhl.c (__ieee754_sinhl): Likewise. * sysdeps/ieee754/ldbl-128ibm/k_cosl.c (__kernel_cosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/k_sincosl.c (__kernel_sincosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_asinhl.c (__asinhl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_atanl.c (__atanl): Likewise. Simplify sign and nan test too. * sysdeps/ieee754/ldbl-128ibm/s_cosl.c (__cosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fabsl.c (__fabsl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_finitel.c (___finitel): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c (___fpclassifyl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_isnanl.c (___isnanl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c (__issignalingl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_signbitl.c (___signbitl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_sincosl.c (__sincosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_sinl.c (__sinl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_tanl.c (__tanl): Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c (__logbl): Likewise.
74 lines
1.9 KiB
C
74 lines
1.9 KiB
C
/* Compute sine and cosine of argument.
|
|
Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
|
|
Jakub Jelinek <jj@ultra.linux.cz>.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <math.h>
|
|
|
|
#include <math_private.h>
|
|
#include <math_ldbl_opt.h>
|
|
|
|
void
|
|
__sincosl (long double x, long double *sinx, long double *cosx)
|
|
{
|
|
int64_t ix;
|
|
double xhi;
|
|
|
|
/* High word of x. */
|
|
xhi = ldbl_high (x);
|
|
EXTRACT_WORDS64 (ix, xhi);
|
|
|
|
/* |x| ~< pi/4 */
|
|
ix &= 0x7fffffffffffffffLL;
|
|
if (ix <= 0x3fe921fb54442d10LL)
|
|
__kernel_sincosl (x, 0.0L, sinx, cosx, 0);
|
|
else if (ix >= 0x7ff0000000000000LL)
|
|
{
|
|
/* sin(Inf or NaN) is NaN */
|
|
*sinx = *cosx = x - x;
|
|
}
|
|
else
|
|
{
|
|
/* Argument reduction needed. */
|
|
long double y[2];
|
|
int n;
|
|
|
|
n = __ieee754_rem_pio2l (x, y);
|
|
switch (n & 3)
|
|
{
|
|
case 0:
|
|
__kernel_sincosl (y[0], y[1], sinx, cosx, 1);
|
|
break;
|
|
case 1:
|
|
__kernel_sincosl (y[0], y[1], cosx, sinx, 1);
|
|
*cosx = -*cosx;
|
|
break;
|
|
case 2:
|
|
__kernel_sincosl (y[0], y[1], sinx, cosx, 1);
|
|
*sinx = -*sinx;
|
|
*cosx = -*cosx;
|
|
break;
|
|
default:
|
|
__kernel_sincosl (y[0], y[1], cosx, sinx, 1);
|
|
*sinx = -*sinx;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
long_double_symbol (libm, __sincosl, sincosl);
|