diff options
author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2016-10-06 13:09:02 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2016-10-06 13:09:02 +0530 |
commit | 36ee03e6a8e0e59e055988f61fc8517096a62fdb (patch) | |
tree | 28f8a464a4e1b5405ec411a6ff37f579bf90e028 | |
parent | 9cb069308c833d98b1ba9c78cb41cff0e90f323d (diff) | |
download | glibc-36ee03e6a8e0e59e055988f61fc8517096a62fdb.tar.gz glibc-36ee03e6a8e0e59e055988f61fc8517096a62fdb.tar.xz glibc-36ee03e6a8e0e59e055988f61fc8517096a62fdb.zip |
Update comments for some functions in s_sin.c
Update comments for some functions to bring them in sync with what the functions are actually doing.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_sin.c | 39 |
2 files changed, 20 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog index 4a9676f93c..d221a037ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-10-06 Siddhesh Poyarekar <siddhesh@sourceware.org> + * sysdeps/ieee754/dbl-64/s_sin.c (reduce_and_compute, do_sincos_1, + do_sincos_2, sloww, sloww1): Update comments. + * sysdeps/ieee754/dbl-64/s_sincos.c (__sincos): Adjust calls to do_sincos_1 and do_sincos_2 to pass a boolean shift_quadrant. diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c index 26b984d207..96b21cfdcc 100644 --- a/sysdeps/ieee754/dbl-64/s_sin.c +++ b/sysdeps/ieee754/dbl-64/s_sin.c @@ -263,9 +263,9 @@ do_sin_slow (double x, double dx, double eps, double *corp) return res; } -/* Reduce range of X and compute sin of a + da. K is the amount by which to - rotate the quadrants. This allows us to use the same routine to compute cos - by simply rotating the quadrants by 1. */ +/* Reduce range of X and compute sin of a + da. When SHIFT_QUADRANT is true, + the routine returns the cosine of a + da by rotating the quadrant once and + computing the sine of the result. */ static inline double __always_inline reduce_and_compute (double x, bool shift_quadrant) @@ -315,8 +315,8 @@ reduce_sincos_1 (double x, double *a, double *da) return n; } -/* Compute sin (A + DA). cos can be computed by shifting the quadrant N - clockwise. */ +/* Compute sin (A + DA). cos can be computed by passing SHIFT_QUADRANT as + true, which results in shifting the quadrant N clockwise. */ static double __always_inline do_sincos_1 (double a, double da, double x, int4 n, bool shift_quadrant) @@ -387,8 +387,8 @@ reduce_sincos_2 (double x, double *a, double *da) return n; } -/* Compute sin (A + DA). cos can be computed by shifting the quadrant N - clockwise. */ +/* Compute sin (A + DA). cos can be computed by passing SHIFT_QUADRANT as + true, which results in shifting the quadrant N clockwise. */ static double __always_inline do_sincos_2 (double a, double da, double x, int4 n, bool shift_quadrant) @@ -686,14 +686,11 @@ slow2 (double x) return __mpsin (fabs (x), 0, false); } -/***************************************************************************/ -/* Routine compute sin(x+dx) (Double-Length number) where x is small enough*/ -/* to use Taylor series around zero and (x+dx) */ -/* in first or third quarter of unit circle.Routine receive also */ -/* (right argument) the original value of x for computing error of */ -/* result.And if result not accurate enough routine calls mpsin1 or dubsin */ -/***************************************************************************/ - +/* Compute sin(x + dx) where X is small enough to use Taylor series around zero + and (x + dx) in the first or third quarter of the unit circle. ORIG is the + original value of X for computing error of the result. If the result is not + accurate enough, the routine calls mpsin or dubsin. SHIFT_QUADRANT rotates + the unit circle by 1 to compute the cosine instead of sine. */ static inline double __always_inline sloww (double x, double dx, double orig, bool shift_quadrant) @@ -748,13 +745,11 @@ sloww (double x, double dx, double orig, bool shift_quadrant) return shift_quadrant ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true); } -/***************************************************************************/ -/* Routine compute sin(x+dx) (Double-Length number) where x in first or */ -/* third quarter of unit circle.Routine receive also (right argument) the */ -/* original value of x for computing error of result.And if result not */ -/* accurate enough routine calls mpsin1 or dubsin */ -/***************************************************************************/ - +/* Compute sin(x + dx) where X is in the first or third quarter of the unit + circle. ORIG is the original value of X for computing error of the result. + If the result is not accurate enough, the routine calls mpsin or dubsin. + SHIFT_QUADRANT rotates the unit circle by 1 to compute the cosine instead of + sine. */ static inline double __always_inline sloww1 (double x, double dx, double orig, bool shift_quadrant) |