[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r24053 - in /fsf/trunk/libc: ./ benchtests/ math/ ports/ ports/sysdeps/arm/bits/ stdlib/ sysdeps/ieee754/dbl-64/
- To: commits@xxxxxxxxxx
- Subject: [Commits] r24053 - in /fsf/trunk/libc: ./ benchtests/ math/ ports/ ports/sysdeps/arm/bits/ stdlib/ sysdeps/ieee754/dbl-64/
- From: eglibc@xxxxxxxxxx
- Date: Fri, 20 Sep 2013 00:01:53 -0000
Author: eglibc
Date: Fri Sep 20 00:01:51 2013
New Revision: 24053
Log:
Import glibc-mainline for 2013-09-20
Added:
fsf/trunk/libc/benchtests/bench-sincos.c
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/benchtests/Makefile
fsf/trunk/libc/math/libm-test.inc
fsf/trunk/libc/ports/ChangeLog.arm
fsf/trunk/libc/ports/sysdeps/arm/bits/atomic.h
fsf/trunk/libc/stdlib/strtod_l.c
fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_sin.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Sep 20 00:01:51 2013
@@ -1,3 +1,51 @@
+2013-09-19 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (POLYNOMIAL2): New macro.
+ (POLYNOMIAL): Likewise.
+ (TAYLOR_SINCOS): Likewise.
+ (TAYLOR_SLOW): Likewise.
+ (__sin): Use TAYLOR_SINCOS.
+ (__cos): Likewise.
+ (slow): Use TAYLOR_SLOW.
+ (sloww): Likewise.
+ (bsloww): Likewise.
+ (csloww): Likewise.
+
+2013-09-19 Liubov Dmitrieva <liubov.dmitrieva@xxxxxxxxx>
+
+ * stdlib/strtod_l.c: Fix buffer overrun.
+
+2013-09-19 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * benchtests/Makefile (bench): Add sincos.
+ * benchtests/bench-sincos.c: New file.
+
+ * math/libm-test.inc (cos_test_data): New test inputs.
+ (sin_test_data): Likewise.
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (SINCOS_TABLE_LOOKUP): New
+ macro.
+ (__sin): Use it.
+ (__cos): Likewise.
+ (slow1): Likewise.
+ (slow2): Likewise.
+ (sloww1): Likewise.
+ (sloww2): Likewise.
+ (bsloww1): Likewise.
+ (bsloww2): Likewise.
+ (cslow2): Likewise.
+ (csloww1): Likewise.
+ (csloww2): Likewise.
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (reduce_and_compute): New
+ function.
+ (__sin): Use it.
+ (__cos): Likewise.
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (__sin): Remove redundant
+ gotos.
+ (__cos): Likewise.
+
2013-09-18 Maciej W. Rozycki <macro@xxxxxxxxxxxxxxxx>
* config.h.in (HAVE_MIPS_NAN2008): New macro.
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Fri Sep 20 00:01:51 2013
@@ -9,9 +9,9 @@
* The following bugs are resolved with this release:
- 14155, 14699, 15427, 15522, 15531, 15532, 15736, 15748, 15749, 15797,
- 15844, 15849, 15855, 15856, 15857, 15867, 15886, 15887, 15890, 15892,
- 15893, 15895, 15897, 15905, 15909, 15921, 15939, 15966.
+ 14155, 14699, 15427, 15522, 15531, 15532, 15640, 15736, 15748, 15749,
+ 15797, 15844, 15849, 15855, 15856, 15857, 15867, 15886, 15887, 15890,
+ 15892, 15893, 15895, 15897, 15905, 15909, 15921, 15939, 15966.
* CVE-2013-4237 The readdir_r function could write more than NAME_MAX bytes
to the d_name member of struct dirent, or omit the terminating NUL
Modified: fsf/trunk/libc/benchtests/Makefile
==============================================================================
--- fsf/trunk/libc/benchtests/Makefile (original)
+++ fsf/trunk/libc/benchtests/Makefile Fri Sep 20 00:01:51 2013
@@ -21,7 +21,7 @@
subdir := benchtests
bench := acos acosh asin asinh atan atanh cos cosh exp log modf pow rint sin \
- sinh tan tanh
+ sincos sinh tan tanh
# String function benchmarks.
string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
@@ -98,6 +98,8 @@
tanh-RET = double
LDLIBS-bench-tanh = -lm
+LDLIBS-bench-sincos = -lm
+
# Rules to build and execute the benchmarks. Do not put any benchmark
Added: fsf/trunk/libc/benchtests/bench-sincos.c
==============================================================================
--- fsf/trunk/libc/benchtests/bench-sincos.c (added)
+++ fsf/trunk/libc/benchtests/bench-sincos.c Fri Sep 20 00:01:51 2013
@@ -1,0 +1,86 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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/>. */
+
+extern void sincos (double, double *, double *);
+
+#define CALL_BENCH_FUNC(v, i, j, k) sincos ( variants[v].in[i].arg0, &j, &k);
+
+struct args
+{
+ volatile double arg0;
+};
+
+struct args in0[12] =
+{
+ { 0.9 },
+ { 2.3 },
+ { 3.7 },
+ { 3.9 },
+ { 4.0 },
+ { 4.7 },
+ { 5.9 },
+
+ { 0x1.000000cf4a2a1p0 },
+ { 0x1.0000010b239a8p0 },
+ { 0x1.00000162a932ap0 },
+ { 0x1.000002d452a11p0 },
+ { 0x1.000005bc7d86cp0 }
+};
+
+struct args in1[12] =
+{
+ { 0.93340582292648832662962377071381 },
+ { 2.3328432680770916363144351635128 },
+ { 3.7439477503636453548097051680088 },
+ { 3.9225160069792437411706487182528 },
+ { 4.0711651639931289992091478779912 },
+ { 4.7858438478542097982426639646292 },
+ { 5.9840767662578002727968851104379 },
+
+ { 0x1.000000cf4a2a2p0 },
+ { 0x1.0000010b239a9p0 },
+ { 0x1.00000162a932bp0 },
+ { 0x1.000002d452a10p0 },
+ { 0x1.000005bc7d86dp0 }
+};
+
+struct _variants
+{
+ const char *name;
+ int count;
+ struct args *in;
+};
+
+struct _variants variants[2] =
+ {
+ {"sincos()", 12, in0},
+ {"sincos(768bits)", 12, in1},
+ };
+
+#define NUM_VARIANTS 2
+#define NUM_SAMPLES(i) (variants[i].count)
+#define VARIANT(i) (variants[i].name)
+
+#define BENCH_FUNC(v, j) \
+({ \
+ volatile double iptr; \
+ volatile double iptr2; \
+ CALL_BENCH_FUNC (v, j, iptr, iptr2); \
+})
+
+#define FUNCNAME "sincos"
+#include "bench-skeleton.c"
Modified: fsf/trunk/libc/math/libm-test.inc
==============================================================================
--- fsf/trunk/libc/math/libm-test.inc (original)
+++ fsf/trunk/libc/math/libm-test.inc Fri Sep 20 00:01:51 2013
@@ -6836,6 +6836,14 @@
TEST_f_f (cos, 0x1.fffffep+127, 8.53021039830304158051791467692161107353094e-01L),
TEST_f_f (cos, 0x1p+50, 8.68095904660550604334592502063501320395739e-01L),
TEST_f_f (cos, 0x1p+28, -1.65568979490578758865468278195361551113358e-01L),
+
+#ifdef TEST_DOUBLE
+ TEST_f_f (cos, 0x1.000000cf4a2a2p0, 0x1.14a27f9e7521ep-1);
+ TEST_f_f (cos, 0x1.0000010b239a9p0, 0x1.14a27f39bc09dp-1);
+ TEST_f_f (cos, 0x1.00000162a932bp0, 0x1.14a27ea670b8cp-1);
+ TEST_f_f (cos, 0x1.000002d452a10p0, 0x1.14a27c385222ep-1);
+ TEST_f_f (cos, 0x1.000005bc7d86dp0, 0x1.14a27753ee07ap-1);
+#endif
};
static void
@@ -13305,6 +13313,16 @@
TEST_f_f (sin, 0x1.fffffep+127, -5.21876523333658540551505357019806722935726e-01L),
TEST_f_f (sin, 0x1p+50, 4.96396515208940840876821859865411368093356e-01L),
TEST_f_f (sin, 0x1p+28, -9.86198211836975655703110310527108292055548e-01L),
+
+#ifdef TEST_DOUBLE
+ TEST_f_f (sin, 0.93340582292648832662962377071381, 0x1.9b78326675a75p-1);
+ TEST_f_f (sin, 2.3328432680770916363144351635128, 0x1.7264abddb4205p-1);
+ TEST_f_f (sin, 3.7439477503636453548097051680088, -0x1.2217622485d94p-1);
+ TEST_f_f (sin, 3.9225160069792437411706487182528, -0x1.686a3d55a1306p-1);
+ TEST_f_f (sin, 4.0711651639931289992091478779912, -0x1.9a4c6be7f5eadp-1);
+ TEST_f_f (sin, 4.7858438478542097982426639646292, -0x1.fe9e8d4105e51p-1);
+ TEST_f_f (sin, 5.9840767662578002727968851104379, -0x1.2dbd90aa4d692p-2);
+#endif
};
static void
Modified: fsf/trunk/libc/ports/ChangeLog.arm
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.arm (original)
+++ fsf/trunk/libc/ports/ChangeLog.arm Fri Sep 20 00:01:51 2013
@@ -1,3 +1,13 @@
+2013-09-18 Dinar Temirbulatov <dtemirbulatov@xxxxxxxxx>
+
+ [BZ #15640]
+ * sysdeps/arm/bits/atomic.h (atomic_exchange_acq, atomic_exchange_rel)
+ (atomic_compare_and_exchange_bool_acq)
+ (atomic_compare_and_exchange_val_acq)
+ (atomic_compare_and_exchange_bool_rel)
+ (atomic_compare_and_exchange_val_rel): Use __atomic_exchange_n and
+ __atomic_compare_exchange_n builtins when GCC supports them.
+
2013-09-16 Will Newton <will.newton@xxxxxxxxxx>
* sysdeps/arm/armv7/multiarch/memcpy_impl.S: Tighten check
Modified: fsf/trunk/libc/ports/sysdeps/arm/bits/atomic.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/arm/bits/atomic.h (original)
+++ fsf/trunk/libc/ports/sysdeps/arm/bits/atomic.h Fri Sep 20 00:01:51 2013
@@ -35,9 +35,6 @@
void __arm_link_error (void);
-/* Use the atomic builtins provided by GCC in case the backend provides
- a pattern to do this efficiently. */
-
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
# define atomic_full_barrier() __sync_synchronize ()
#else
@@ -51,9 +48,88 @@
# define __arm_assisted_full_barrier() __arm_link_error()
#endif
+/* Use the atomic builtins provided by GCC in case the backend provides
+ a pattern to do this efficiently. */
+#if __GNUC_PREREQ (4, 7) && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+
+# define atomic_exchange_acq(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_ACQUIRE)
+
+# define atomic_exchange_rel(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_RELEASE)
+
+/* Atomic exchange (without compare). */
+
+# define __arch_exchange_8_int(mem, newval, model) \
+ (__arm_link_error (), (typeof (*mem)) 0)
+
+# define __arch_exchange_16_int(mem, newval, model) \
+ (__arm_link_error (), (typeof (*mem)) 0)
+
+# define __arch_exchange_32_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_64_int(mem, newval, model) \
+ (__arm_link_error (), (typeof (*mem)) 0)
+
+/* Compare and exchange with "acquire" semantics, ie barrier after. */
+
+# define atomic_compare_and_exchange_bool_acq(mem, new, old) \
+ __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+# define atomic_compare_and_exchange_val_acq(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+/* Compare and exchange with "release" semantics, ie barrier before. */
+
+# define atomic_compare_and_exchange_bool_rel(mem, new, old) \
+ __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
+ mem, new, old, __ATOMIC_RELEASE)
+
+# define atomic_compare_and_exchange_val_rel(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_RELEASE)
+
+/* Compare and exchange.
+ For all "bool" routines, we return FALSE if exchange succesful. */
+
+# define __arch_compare_and_exchange_bool_8_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_bool_16_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_bool_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_64_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_val_8_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_val_16_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_val_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_64_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+#elif defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
/* Atomic compare and exchange. */
-
-#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
# define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
__sync_val_compare_and_swap ((mem), (oldval), (newval))
#else
@@ -61,16 +137,18 @@
__arm_assisted_compare_and_exchange_val_32_acq ((mem), (newval), (oldval))
#endif
+#if !__GNUC_PREREQ (4, 7) || !defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
/* We don't support atomic operations on any non-word types.
So make them link errors. */
-#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
+# define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
({ __arm_link_error (); oldval; })
-#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
+# define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
({ __arm_link_error (); oldval; })
-#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
+# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
({ __arm_link_error (); oldval; })
+#endif
/* An OS-specific bits/atomic.h file will define this macro if
the OS can provide something. If not, we'll fail to build
Modified: fsf/trunk/libc/stdlib/strtod_l.c
==============================================================================
--- fsf/trunk/libc/stdlib/strtod_l.c (original)
+++ fsf/trunk/libc/stdlib/strtod_l.c Fri Sep 20 00:01:51 2013
@@ -1752,7 +1752,7 @@
got_limb;
}
- for (i = densize; num[i] == 0 && i >= 0; --i)
+ for (i = densize; i >= 0 && num[i] == 0; --i)
;
return round_and_return (retval, exponent - 1, negative,
quot, BITS_PER_MP_LIMB - 1 - used,
Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_sin.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_sin.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_sin.c Fri Sep 20 00:01:51 2013
@@ -55,6 +55,59 @@
#include <math_private.h>
#include <fenv.h>
+/* Helper macros to compute sin of the input values. */
+#define POLYNOMIAL2(xx) ((((s5.x * (xx) + s4.x) * (xx) + s3.x) * (xx) + s2.x) \
+ * (xx))
+
+#define POLYNOMIAL(xx) (POLYNOMIAL2 (xx) + s1.x)
+
+/* The computed polynomial is a variation of the Taylor series expansion for
+ sin(a):
+
+ a - a^3/3! + a^5/5! - a^7/7! + a^9/9! + (1 - a^2) * da / 2
+
+ The constants s1, s2, s3, etc. are pre-computed values of 1/3!, 1/5! and so
+ on. The result is returned to LHS and correction in COR. */
+#define TAYLOR_SINCOS(xx, a, da, cor) \
+({ \
+ double t = ((POLYNOMIAL (xx) * (a) - 0.5 * (da)) * (xx) + (da)); \
+ double res = (a) + t; \
+ (cor) = ((a) - res) + t; \
+ res; \
+})
+
+/* This is again a variation of the Taylor series expansion with the term
+ x^3/3! expanded into the following for better accuracy:
+
+ bb * x ^ 3 + 3 * aa * x * x1 * x2 + aa * x1 ^ 3 + aa * x2 ^ 3
+
+ The correction term is dx and bb + aa = -1/3!
+ */
+#define TAYLOR_SLOW(x0, dx, cor) \
+({ \
+ static const double th2_36 = 206158430208.0; /* 1.5*2**37 */ \
+ double xx = (x0) * (x0); \
+ double x1 = ((x0) + th2_36) - th2_36; \
+ double y = aa.x * x1 * x1 * x1; \
+ double r = (x0) + y; \
+ double x2 = ((x0) - x1) + (dx); \
+ double t = (((POLYNOMIAL2 (xx) + bb.x) * xx + 3.0 * aa.x * x1 * x2) \
+ * (x0) + aa.x * x2 * x2 * x2 + (dx)); \
+ t = (((x0) - r) + y) + t; \
+ double res = r + t; \
+ (cor) = (r - res) + t; \
+ res; \
+})
+
+#define SINCOS_TABLE_LOOKUP(u, sn, ssn, cs, ccs) \
+({ \
+ int4 k = u.i[LOW_HALF] << 2; \
+ sn = __sincostab.x[k]; \
+ ssn = __sincostab.x[k + 1]; \
+ cs = __sincostab.x[k + 2]; \
+ ccs = __sincostab.x[k + 3]; \
+})
+
#ifndef SECTION
# define SECTION
#endif
@@ -93,6 +146,39 @@
static double csloww1 (double x, double dx, double orig);
static double csloww2 (double x, double dx, double orig, int n);
+/* 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. */
+static inline double
+__always_inline
+reduce_and_compute (double x, double a, double da, unsigned int k)
+{
+ double retval = 0;
+ unsigned int n = __branred (x, &a, &da);
+ k = (n + k) % 4;
+ switch (k)
+ {
+ case 0:
+ if (a * a < 0.01588)
+ retval = bsloww (a, da, x, n);
+ else
+ retval = bsloww1 (a, da, x, n);
+ break;
+ case 2:
+ if (a * a < 0.01588)
+ retval = bsloww (-a, -da, x, n);
+ else
+ retval = bsloww1 (-a, -da, x, n);
+ break;
+
+ case 1:
+ case 3:
+ retval = bsloww2 (a, da, x, n);
+ break;
+ }
+ return retval;
+}
+
/*******************************************************************/
/* An ultimate sin routine. Given an IEEE double machine number x */
/* it computes the correctly rounded (to nearest) value of sin(x) */
@@ -113,21 +199,16 @@
m = u.i[HIGH_HALF];
k = 0x7fffffff & m; /* no sign */
if (k < 0x3e500000) /* if x->0 =>sin(x)=x */
- {
- retval = x;
- goto ret;
- }
+ retval = x;
/*---------------------------- 2^-26 < |x|< 0.25 ----------------------*/
else if (k < 0x3fd00000)
{
xx = x * x;
- /*Taylor series. */
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + s1.x)
- * (xx * x));
+ /* Taylor series. */
+ t = POLYNOMIAL (xx) * (xx * x);
res = x + t;
cor = (x - res) + t;
retval = (res == res + 1.07 * cor) ? res : slow (x);
- goto ret;
} /* else if (k < 0x3fd00000) */
/*---------------------------- 0.25<|x|< 0.855469---------------------- */
else if (k < 0x3feb6000)
@@ -137,16 +218,16 @@
xx = y * y;
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = (m > 0) ? __sincostab.x[k] : -__sincostab.x[k];
- ssn = (m > 0) ? __sincostab.x[k + 1] : -__sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
+ if (m <= 0)
+ {
+ sn = -sn;
+ ssn = -ssn;
+ }
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
retval = (res == res + 1.096 * cor) ? res : slow1 (x);
- goto ret;
} /* else if (k < 0x3feb6000) */
/*----------------------- 0.855469 <|x|<2.426265 ----------------------*/
@@ -167,16 +248,11 @@
xx = y * y;
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ccs - s * ssn - cs * c) - sn * s;
res = cs + cor;
cor = (cs - res) + cor;
retval = (res == res + 1.020 * cor) ? ((m > 0) ? res : -res) : slow2 (x);
- goto ret;
} /* else if (k < 0x400368fd) */
/*-------------------------- 2.426265<|x|< 105414350 ----------------------*/
@@ -204,14 +280,10 @@
}
if (xx < 0.01588)
{
- /*Taylor series */
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
- + s1.x) * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ /* Taylor series. */
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
retval = (res == res + cor) ? res : sloww (a, da, x);
- goto ret;
}
else
{
@@ -232,18 +304,13 @@
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)
: sloww1 (a, da, x));
- goto ret;
}
break;
@@ -257,11 +324,7 @@
u.x = big.x + a;
y = a - (u.x - big.x) + da;
xx = y * y;
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
cor = (ccs - s * ssn - cs * c) - sn * s;
@@ -270,11 +333,8 @@
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
retval = ((res == res + cor) ? ((n & 2) ? -res : res)
: sloww2 (a, da, x, n));
- goto ret;
-
break;
}
-
} /* else if (k < 0x419921FB ) */
/*---------------------105414350 <|x|< 281474976710656 --------------------*/
@@ -307,14 +367,10 @@
}
if (xx < 0.01588)
{
- /* Taylor series */
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
- + s1.x) * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ /* Taylor series. */
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
retval = (res == res + cor) ? res : bsloww (a, da, x, n);
- goto ret;
}
else
{
@@ -335,18 +391,13 @@
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)
: bsloww1 (a, da, x, n));
- goto ret;
}
break;
@@ -360,11 +411,7 @@
u.x = big.x + a;
y = a - (u.x - big.x) + da;
xx = y * y;
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
cor = (ccs - s * ssn - cs * c) - sn * s;
@@ -373,40 +420,13 @@
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
retval = ((res == res + cor) ? ((n & 2) ? -res : res)
: bsloww2 (a, da, x, n));
- goto ret;
-
break;
}
} /* else if (k < 0x42F00000 ) */
/* -----------------281474976710656 <|x| <2^1024----------------------------*/
else if (k < 0x7ff00000)
- {
- n = __branred (x, &a, &da);
- switch (n)
- {
- case 0:
- if (a * a < 0.01588)
- retval = bsloww (a, da, x, n);
- else
- retval = bsloww1 (a, da, x, n);
- goto ret;
- break;
- case 2:
- if (a * a < 0.01588)
- retval = bsloww (-a, -da, x, n);
- else
- retval = bsloww1 (-a, -da, x, n);
- goto ret;
- break;
-
- case 1:
- case 3:
- retval = bsloww2 (a, da, x, n);
- goto ret;
- break;
- }
- } /* else if (k < 0x7ff00000 ) */
+ retval = reduce_and_compute (x, a, da, 0);
/*--------------------- |x| > 2^1024 ----------------------------------*/
else
@@ -414,10 +434,8 @@
if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
__set_errno (EDOM);
retval = x / x;
- goto ret;
- }
-
-ret:
+ }
+
return retval;
}
@@ -444,11 +462,9 @@
m = u.i[HIGH_HALF];
k = 0x7fffffff & m;
+ /* |x|<2^-27 => cos(x)=1 */
if (k < 0x3e400000)
- {
- retval = 1.0;
- goto ret;
- } /* |x|<2^-27 => cos(x)=1 */
+ retval = 1.0;
else if (k < 0x3feb6000)
{ /* 2^-27 < |x| < 0.855469 */
@@ -458,16 +474,11 @@
xx = y * y;
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ccs - s * ssn - cs * c) - sn * s;
res = cs + cor;
cor = (cs - res) + cor;
retval = (res == res + 1.020 * cor) ? res : cslow2 (x);
- goto ret;
} /* else if (k < 0x3feb6000) */
else if (k < 0x400368fd)
@@ -478,13 +489,9 @@
xx = a * a;
if (xx < 0.01588)
{
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + s1.x)
- * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + 1.0e-31 : 1.02 * cor - 1.0e-31;
retval = (res == res + cor) ? res : csloww (a, da, x);
- goto ret;
}
else
{
@@ -505,18 +512,13 @@
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + 1.0e-31 : 1.035 * cor - 1.0e-31;
retval = ((res == res + cor) ? ((m) ? res : -res)
: csloww1 (a, da, x));
- goto ret;
}
} /* else if (k < 0x400368fd) */
@@ -546,13 +548,9 @@
}
if (xx < 0.01588)
{
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
- + s1.x) * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
retval = (res == res + cor) ? res : csloww (a, da, x);
- goto ret;
}
else
{
@@ -573,18 +571,13 @@
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)
: csloww1 (a, da, x));
- goto ret;
}
break;
@@ -598,11 +591,7 @@
u.x = big.x + a;
y = a - (u.x - big.x) + da;
xx = y * y;
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
cor = (ccs - s * ssn - cs * c) - sn * s;
@@ -611,8 +600,6 @@
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
retval = ((res == res + cor) ? ((n) ? -res : res)
: csloww2 (a, da, x, n));
- goto ret;
-
break;
}
} /* else if (k < 0x419921FB ) */
@@ -646,13 +633,9 @@
}
if (xx < 0.01588)
{
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
- + s1.x) * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
retval = (res == res + cor) ? res : bsloww (a, da, x, n);
- goto ret;
}
else
{
@@ -673,18 +656,13 @@
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)
: bsloww1 (a, da, x, n));
- goto ret;
}
break;
@@ -698,11 +676,7 @@
u.x = big.x + a;
y = a - (u.x - big.x) + da;
xx = y * y;
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
cor = (ccs - s * ssn - cs * c) - sn * s;
@@ -711,49 +685,21 @@
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
retval = ((res == res + cor) ? ((n) ? -res : res)
: bsloww2 (a, da, x, n));
- goto ret;
break;
}
} /* else if (k < 0x42F00000 ) */
+ /* 281474976710656 <|x| <2^1024 */
else if (k < 0x7ff00000)
- { /* 281474976710656 <|x| <2^1024 */
-
- n = __branred (x, &a, &da);
- switch (n)
- {
- case 1:
- if (a * a < 0.01588)
- retval = bsloww (-a, -da, x, n);
- else
- retval = bsloww1 (-a, -da, x, n);
- goto ret;
- break;
- case 3:
- if (a * a < 0.01588)
- retval = bsloww (a, da, x, n);
- else
- retval = bsloww1 (a, da, x, n);
- goto ret;
- break;
-
- case 0:
- case 2:
- retval = bsloww2 (a, da, x, n);
- goto ret;
- break;
- }
- } /* else if (k < 0x7ff00000 ) */
+ retval = reduce_and_compute (x, a, da, 1);
else
{
if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
__set_errno (EDOM);
retval = x / x; /* |x| > 2^1024 */
- goto ret;
- }
-
-ret:
+ }
+
return retval;
}
@@ -766,18 +712,8 @@
SECTION
slow (double x)
{
- static const double th2_36 = 206158430208.0; /* 1.5*2**37 */
- double y, x1, x2, xx, r, t, res, cor, w[2];
- x1 = (x + th2_36) - th2_36;
- y = aa.x * x1 * x1 * x1;
- r = x + y;
- x2 = x - x1;
- xx = x * x;
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + bb.x) * xx
- + 3.0 * aa.x * x1 * x2) * x + aa.x * x2 * x2 * x2;
- t = ((x - r) + y) + t;
- res = r + t;
- cor = (r - res) + t;
+ double res, cor, w[2];
+ res = TAYLOR_SLOW (x, 0, cor);
if (res == res + 1.0007 * cor)
return res;
else
@@ -802,18 +738,13 @@
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, c1, c2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
y = y - (u.x - big.x);
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k]; /* Data */
- ssn = __sincostab.x[k + 1]; /* from */
- cs = __sincostab.x[k + 2]; /* tables */
- ccs = __sincostab.x[k + 3]; /* __sincostab.tbl */
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = y - y1;
c1 = (cs + t22) - t22;
@@ -846,7 +777,6 @@
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res, del;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
y = hp0.x - y;
if (y >= 0)
@@ -864,11 +794,7 @@
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = y * del + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + del;
e1 = (sn + t22) - t22;
@@ -905,24 +831,14 @@
SECTION
sloww (double x, double dx, double orig)
{
- static const double th2_36 = 206158430208.0; /* 1.5*2**37 */
- double y, x1, x2, xx, r, t, res, cor, w[2], a, da, xn;
+ double y, t, res, cor, w[2], a, da, xn;
union
{
int4 i[2];
double x;
} v;
int4 n;
- x1 = (x + th2_36) - th2_36;
- y = aa.x * x1 * x1 * x1;
- r = x + y;
- x2 = (x - x1) + dx;
- xx = x * x;
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + bb.x) * xx
- + 3.0 * aa.x * x1 * x2) * x + aa.x * x2 * x2 * x2 + dx;
- t = ((x - r) + y) + t;
- res = r + t;
- cor = (r - res) + t;
+ res = TAYLOR_SLOW (x, dx, cor);
cor =
(cor >
0) ? 1.0005 * cor + ABS (orig) * 3.1e-30 : 1.0005 * cor -
@@ -985,7 +901,6 @@
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, c1, c2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -994,11 +909,7 @@
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
c1 = (cs + t22) - t22;
@@ -1046,7 +957,6 @@
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1055,11 +965,7 @@
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = y * dx + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
@@ -1106,19 +1012,9 @@
SECTION
bsloww (double x, double dx, double orig, int n)
{
- static const double th2_36 = 206158430208.0; /* 1.5*2**37 */
- double y, x1, x2, xx, r, t, res, cor, w[2];
-
- x1 = (x + th2_36) - th2_36;
- y = aa.x * x1 * x1 * x1;
- r = x + y;
- x2 = (x - x1) + dx;
- xx = x * x;
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + bb.x) * xx
- + 3.0 * aa.x * x1 * x2) * x + aa.x * x2 * x2 * x2 + dx;
- t = ((x - r) + y) + t;
- res = r + t;
- cor = (r - res) + t;
+ double res, cor, w[2];
+
+ res = TAYLOR_SLOW (x, dx, cor);
cor = (cor > 0) ? 1.0005 * cor + 1.1e-24 : 1.0005 * cor - 1.1e-24;
if (res == res + cor)
return res;
@@ -1150,7 +1046,6 @@
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, c1, c2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1159,11 +1054,7 @@
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
c1 = (cs + t22) - t22;
@@ -1206,7 +1097,6 @@
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1215,11 +1105,7 @@
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = y * dx + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
@@ -1261,7 +1147,6 @@
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1269,11 +1154,7 @@
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = y - y1;
e1 = (sn + t22) - t22;
@@ -1308,8 +1189,7 @@
SECTION
csloww (double x, double dx, double orig)
{
- static const double th2_36 = 206158430208.0; /* 1.5*2**37 */
- double y, x1, x2, xx, r, t, res, cor, w[2], a, da, xn;
+ double y, t, res, cor, w[2], a, da, xn;
union
{
int4 i[2];
@@ -1317,17 +1197,8 @@
} v;
int4 n;
- x1 = (x + th2_36) - th2_36;
- y = aa.x * x1 * x1 * x1;
- r = x + y;
- x2 = (x - x1) + dx;
- xx = x * x;
/* Taylor series */
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + bb.x) * xx
- + 3.0 * aa.x * x1 * x2) * x + aa.x * x2 * x2 * x2 + dx;
- t = ((x - r) + y) + t;
- res = r + t;
- cor = (r - res) + t;
+ t = TAYLOR_SLOW (x, dx, cor);
if (cor > 0)
cor = 1.0005 * cor + ABS (orig) * 3.1e-30;
@@ -1394,7 +1265,6 @@
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, c1, c2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1403,11 +1273,7 @@
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
c1 = (cs + t22) - t22;
@@ -1454,7 +1320,6 @@
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1463,11 +1328,7 @@
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = y * dx + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits