diff options
author | Siddhesh Poyarekar <siddhesh.poyarekar@linaro.org> | 2015-12-21 10:41:46 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh.poyarekar@linaro.org> | 2015-12-21 10:41:46 +0530 |
commit | f7953c44d545c91442f123300288853284501dab (patch) | |
tree | aeb5c53572f6b49895fc03b5f8a84cf727d0e369 /sysdeps/ieee754/dbl-64/s_sincos.c | |
parent | a045832debe4191bcffed6e539a5470152e9c9e8 (diff) | |
download | glibc-f7953c44d545c91442f123300288853284501dab.tar.gz glibc-f7953c44d545c91442f123300288853284501dab.tar.xz glibc-f7953c44d545c91442f123300288853284501dab.zip |
Consolidate sin and cos code for 105414350 <|x|< 281474976710656
The sin and cos computation for this range of input is identical except for a difference in quadrants by 1. Exploit that fact and the common argument reduction to reduce computations for sincos.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_sincos.c')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_sincos.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c index f50ffa625f..7f78b4106f 100644 --- a/sysdeps/ieee754/dbl-64/s_sincos.c +++ b/sysdeps/ieee754/dbl-64/s_sincos.c @@ -69,12 +69,22 @@ __sincos (double x, double *sinx, double *cosx) u.x = x; k = 0x7fffffff & u.i[HIGH_HALF]; - if (k < 0x42F00000) + if (k < 0x419921FB) { *sinx = __sin_local (x); *cosx = __cos_local (x); return; } + if (k < 0x42F00000) + { + double a, da; + int4 n = reduce_sincos_2 (x, &a, &da); + + *sinx = do_sincos_2 (a, da, x, n, 0); + *cosx = do_sincos_2 (a, da, x, n, 1); + + return; + } if (k < 0x7ff00000) { reduce_and_compute_sincos (x, sinx, cosx); |