This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.24-213-gba4e688
- From: siddhesh at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 5 Oct 2016 19:08:01 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.24-213-gba4e688
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via ba4e688461a0e3171a6c515040ec9200319070b6 (commit)
via b8b7e5e644363f9ab6ea6df5d4a44389d28e5450 (commit)
from 8028566ed9418ffa5070c60b5a477ed45653469b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ba4e688461a0e3171a6c515040ec9200319070b6
commit ba4e688461a0e3171a6c515040ec9200319070b6
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Thu Oct 6 00:34:26 2016 +0530
Check n instead of k1 to decide on sign of sin/cos result
For k1 in 1 and 3, n can only have values of 0 and 2, so checking k1 &
2 is equivalent to checking n & 2. We prefer the latter so that we
don't use k1 for anything other than selecting the quadrant in
do_sincos_1, thus dropping it completely.
The previous logic was:
"Compute sine for the value and based on the new rotated quadrant
(k1) negate the value if we're in the fourth quadrant."
With this change, the logic now is:
"Compute sine for the value and negate it if we were either (1) in
the fourth quadrant or (2) we actually wanted the cosine and were
in the third quadrant."
* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Check N
instead of K1.
diff --git a/ChangeLog b/ChangeLog
index ff38c6e..2495a2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-10-05 Siddhesh Poyarekar <siddhesh@sourceware.org>
+ * sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Check N
+ instead of K1.
+
* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Rename K to
SHIFT_QUADRANT and make it bool.
(do_sincos_2): Likewise.
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index 76cf996..67bdebf 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -353,7 +353,7 @@ do_sincos_1 (double a, double da, double x, int4 n, bool shift_quadrant)
case 3:
res = do_cos (a, da, &cor);
cor = 1.025 * cor + __copysign (eps, cor);
- retval = ((res == res + cor) ? ((k1 & 2) ? -res : res)
+ retval = ((res == res + cor) ? ((n & 2) ? -res : res)
: sloww2 (a, da, x, n));
break;
}
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b8b7e5e644363f9ab6ea6df5d4a44389d28e5450
commit b8b7e5e644363f9ab6ea6df5d4a44389d28e5450
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Thu Oct 6 00:33:54 2016 +0530
Make the quadrant shift K a bool in do_sincos_* functions
The do_sincos_* functions are helpers to compute sin/cos, where they
get cosine by computing sine for the next quadrant. This is decided
with the value of K passed to it, which is the amount by which to
shift the quadrant. Since we will only need the shift to be 0 or 1,
we make K a bool to make that explicit.
* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Rename K to
SHIFT_QUADRANT and make it bool.
(do_sincos_2): Likewise.
(sloww): Likewise.
(sloww1): Likewise.
(__sin): Adjust calls to do_sincos_1 and do_sincos_2.
(__cos): Likewise.
diff --git a/ChangeLog b/ChangeLog
index ccdffd7..ff38c6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-10-05 Siddhesh Poyarekar <siddhesh@sourceware.org>
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Rename K to
+ SHIFT_QUADRANT and make it bool.
+ (do_sincos_2): Likewise.
+ (sloww): Likewise.
+ (sloww1): Likewise.
+ (__sin): Adjust calls to do_sincos_1 and do_sincos_2.
+ (__cos): Likewise.
+
2016-10-05 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index 8764c58..76cf996 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -132,8 +132,8 @@ double __mpcos (double x, double dx, bool reduce_range);
static double slow (double x);
static double slow1 (double x);
static double slow2 (double x);
-static double sloww (double x, double dx, double orig, int n);
-static double sloww1 (double x, double dx, double orig, int n);
+static double sloww (double x, double dx, double orig, bool shift_quadrant);
+static double sloww1 (double x, double dx, double orig, bool shift_quadrant);
static double sloww2 (double x, double dx, double orig, int n);
static double bsloww (double x, double dx, double orig, int n);
static double bsloww1 (double x, double dx, double orig, int n);
@@ -319,12 +319,12 @@ reduce_sincos_1 (double x, double *a, double *da)
clockwise. */
static double
__always_inline
-do_sincos_1 (double a, double da, double x, int4 n, int4 k)
+do_sincos_1 (double a, double da, double x, int4 n, bool shift_quadrant)
{
double xx, retval, res, cor;
double eps = fabs (x) * 1.2e-30;
- int k1 = (n + k) & 3;
+ int k1 = (n + shift_quadrant) & 3;
switch (k1)
{ /* quarter of unit circle */
case 2:
@@ -338,14 +338,14 @@ do_sincos_1 (double a, double da, double x, int4 n, int4 k)
/* Taylor series. */
res = TAYLOR_SIN (xx, a, da, cor);
cor = 1.02 * cor + __copysign (eps, cor);
- retval = (res == res + cor) ? res : sloww (a, da, x, k);
+ retval = (res == res + cor) ? res : sloww (a, da, x, shift_quadrant);
}
else
{
res = do_sin (a, da, &cor);
cor = 1.035 * cor + __copysign (eps, cor);
retval = ((res == res + cor) ? __copysign (res, a)
- : sloww1 (a, da, x, k));
+ : sloww1 (a, da, x, shift_quadrant));
}
break;
@@ -391,13 +391,13 @@ reduce_sincos_2 (double x, double *a, double *da)
clockwise. */
static double
__always_inline
-do_sincos_2 (double a, double da, double x, int4 n, int4 k)
+do_sincos_2 (double a, double da, double x, int4 n, bool shift_quadrant)
{
double res, retval, cor, xx;
double eps = 1.0e-24;
- k = (n + k) & 3;
+ int4 k = (n + shift_quadrant) & 3;
switch (k)
{
@@ -498,7 +498,7 @@ __sin (double x)
{
double a, da;
int4 n = reduce_sincos_1 (x, &a, &da);
- retval = do_sincos_1 (a, da, x, n, 0);
+ retval = do_sincos_1 (a, da, x, n, false);
} /* else if (k < 0x419921FB ) */
/*---------------------105414350 <|x|< 281474976710656 --------------------*/
@@ -507,7 +507,7 @@ __sin (double x)
double a, da;
int4 n = reduce_sincos_2 (x, &a, &da);
- retval = do_sincos_2 (a, da, x, n, 0);
+ retval = do_sincos_2 (a, da, x, n, false);
} /* else if (k < 0x42F00000 ) */
/* -----------------281474976710656 <|x| <2^1024----------------------------*/
@@ -574,14 +574,14 @@ __cos (double x)
{
res = TAYLOR_SIN (xx, a, da, cor);
cor = 1.02 * cor + __copysign (1.0e-31, cor);
- retval = (res == res + cor) ? res : sloww (a, da, x, 1);
+ retval = (res == res + cor) ? res : sloww (a, da, x, true);
}
else
{
res = do_sin (a, da, &cor);
cor = 1.035 * cor + __copysign (1.0e-31, cor);
retval = ((res == res + cor) ? __copysign (res, a)
- : sloww1 (a, da, x, 1));
+ : sloww1 (a, da, x, true));
}
} /* else if (k < 0x400368fd) */
@@ -592,7 +592,7 @@ __cos (double x)
{ /* 2.426265<|x|< 105414350 */
double a, da;
int4 n = reduce_sincos_1 (x, &a, &da);
- retval = do_sincos_1 (a, da, x, n, 1);
+ retval = do_sincos_1 (a, da, x, n, true);
} /* else if (k < 0x419921FB ) */
else if (k < 0x42F00000)
@@ -600,7 +600,7 @@ __cos (double x)
double a, da;
int4 n = reduce_sincos_2 (x, &a, &da);
- retval = do_sincos_2 (a, da, x, n, 1);
+ retval = do_sincos_2 (a, da, x, n, true);
} /* else if (k < 0x42F00000 ) */
/* 281474976710656 <|x| <2^1024 */
@@ -696,7 +696,7 @@ slow2 (double x)
static inline double
__always_inline
-sloww (double x, double dx, double orig, int k)
+sloww (double x, double dx, double orig, bool shift_quadrant)
{
double y, t, res, cor, w[2], a, da, xn;
mynumber v;
@@ -723,7 +723,7 @@ sloww (double x, double dx, double orig, int k)
xn = t - toint;
v.x = t;
y = (orig - xn * mp1) - xn * mp2;
- n = (v.i[LOW_HALF] + k) & 3;
+ n = (v.i[LOW_HALF] + shift_quadrant) & 3;
da = xn * pp3;
t = y - da;
da = (y - t) - da;
@@ -745,7 +745,7 @@ sloww (double x, double dx, double orig, int k)
if (w[0] == w[0] + cor)
return __copysign (w[0], a);
- return k ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
+ return shift_quadrant ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
}
/***************************************************************************/
@@ -757,7 +757,7 @@ sloww (double x, double dx, double orig, int k)
static inline double
__always_inline
-sloww1 (double x, double dx, double orig, int k)
+sloww1 (double x, double dx, double orig, bool shift_quadrant)
{
double w[2], cor, res;
@@ -775,7 +775,7 @@ sloww1 (double x, double dx, double orig, int k)
if (w[0] == w[0] + cor)
return __copysign (w[0], x);
- return (k == 1) ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
+ return shift_quadrant ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
}
/***************************************************************************/
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 13 +++++++++++++
sysdeps/ieee754/dbl-64/s_sin.c | 40 ++++++++++++++++++++--------------------
2 files changed, 33 insertions(+), 20 deletions(-)
hooks/post-receive
--
GNU C Library master sources