diff options
author | bde <bde@FreeBSD.org> | 2005-11-02 13:06:49 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2005-11-02 13:06:49 +0000 |
commit | 728b935c7f99f10947da6d54873e625c1a7a69c7 (patch) | |
tree | bd9448d5ee6e241450c77e61e5fc86d0316c1dec /lib/msun/src | |
parent | 5edf61585c70920d2a9184173def09909233d0fc (diff) | |
download | FreeBSD-src-728b935c7f99f10947da6d54873e625c1a7a69c7.zip FreeBSD-src-728b935c7f99f10947da6d54873e625c1a7a69c7.tar.gz |
Updated the comment about the optimization for tiny x (the previous
commit moved it). This includes a comment that the "kernel" sine no
longer works on arg -0, so callers must now handle this case. The kernel
sine still works on all other tiny args; without the optimization it is
just a little slower on these args. I intended it to keep working on
all tiny args, but that seems to be impossible without losing efficiency
or accuracy. (sin(x) ~ x * (1 + S1*x**2 + ...) would preserve -0, but
the approximation must be written as x + S1*x**3 + ... for accuracy.)
Diffstat (limited to 'lib/msun/src')
-rw-r--r-- | lib/msun/src/k_sin.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/msun/src/k_sin.c b/lib/msun/src/k_sin.c index 6db5849..fe2a56c 100644 --- a/lib/msun/src/k_sin.c +++ b/lib/msun/src/k_sin.c @@ -16,14 +16,16 @@ static char rcsid[] = "$FreeBSD$"; #endif /* __kernel_sin( x, y, iy) - * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 + * kernel sin function on ~[-pi/4, pi/4] (except on -0), pi/4 ~ 0.7854 * Input x is assumed to be bounded by ~pi/4 in magnitude. * Input y is the tail of x. * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). * * Algorithm * 1. Since sin(-x) = -sin(x), we need only to consider positive x. - * 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0. + * 2. Callers must return sin(-0) = -0 without calling here since our + * odd polynomial is not evaluated in a way that preserves -0. + * Callers may do the optimization sin(x) ~ x for tiny x. * 3. sin(x) is approximated by a polynomial of degree 13 on * [0,pi/4] * 3 13 |