@@ -386,6 +386,7 @@ type-float-routines := \
e_powf_log2_data \
e_sincoshf_data \
math_errf \
+ reduce_aux_data \
s_asincosf_data \
s_asincoshf_data \
s_asincospif_data \
@@ -21,7 +21,43 @@
#include <math.h>
#include <math_private.h>
-#include <s_sincosf.h>
+#include "math_config.h"
+
+/* 2PI * 2^-64. */
+static const double pi63 = 0x1.921FB54442D18p-62;
+
+/* Table with 4/PI to 192 bit precision. */
+extern const uint32_t __inv_pio4[] attribute_hidden;
+
+/* Reduce the range of XI to a multiple of PI/2 using fast integer arithmetic.
+ XI is a reinterpreted float and must be >= 2.0f (the sign bit is ignored).
+ Return the modulo between -PI/4 and PI/4 and store the quadrant in NP.
+ Reduction uses a table of 4/PI with 192 bits of precision. A 32x96->128 bit
+ multiply computes the exact 2.62-bit fixed-point modulo. Since the result
+ can have at most 29 leading zeros after the binary point, the double
+ precision result is accurate to 33 bits. */
+static inline double
+reduce_large (uint32_t xi, int *np)
+{
+ const uint32_t *arr = &__inv_pio4[(xi >> 26) & 15];
+ int shift = (xi >> 23) & 7;
+ uint64_t n, res0, res1, res2;
+
+ xi = (xi & 0xffffff) | 0x800000;
+ xi <<= shift;
+
+ res0 = xi * arr[0];
+ res1 = (uint64_t)xi * arr[4];
+ res2 = (uint64_t)xi * arr[8];
+ res0 = (res2 >> 32) | (res0 << 32);
+ res0 += res1;
+
+ n = (res0 + (1ULL << 61)) >> 62;
+ res0 -= n << 62;
+ double x = (int64_t)res0;
+ *np = n;
+ return x * pi63;
+}
/* Return h and update n such that:
Now x - pi/4 - alpha = h + n*pi/2 mod (2*pi). */
similarity index 57%
rename from sysdeps/x86/fpu/s_sincosf_data.c
rename to sysdeps/ieee754/flt-32/reduce_aux_data.c
@@ -18,42 +18,7 @@
#include <stdint.h>
#include <math.h>
-#include <sysdeps/ieee754/flt-32/math_config.h>
-#include <s_sincosf.h>
-
-/* The constants and polynomials for sine and cosine. The 2nd entry
- computes -cos (x) rather than cos (x) to get negation for free. */
-const sincos_t __sincosf_table[2] =
-{
- {
- { 1.0, -1.0, -1.0, 1.0 },
-#if TOINT_INTRINSICS
- 0x1.45F306DC9C883p-1,
-#else
- 0x1.45F306DC9C883p+23,
-#endif
- 0x1.921FB54442D18p0,
- 0x1p0,
- -0x1.ffffffd0c621cp-2,
- { -0x1.555545995a603p-3, 0x1.55553e1068f19p-5 },
- { 0x1.1107605230bc4p-7, -0x1.6c087e89a359dp-10 },
- { -0x1.994eb3774cf24p-13, 0x1.99343027bf8c3p-16 }
- },
- {
- { 1.0, -1.0, -1.0, 1.0 },
-#if TOINT_INTRINSICS
- 0x1.45F306DC9C883p-1,
-#else
- 0x1.45F306DC9C883p+23,
-#endif
- 0x1.921FB54442D18p0,
- -0x1p0,
- 0x1.ffffffd0c621cp-2,
- { -0x1.555545995a603p-3, -0x1.55553e1068f19p-5 },
- { 0x1.1107605230bc4p-7, 0x1.6c087e89a359dp-10 },
- { -0x1.994eb3774cf24p-13, -0x1.99343027bf8c3p-16 }
- }
-};
+#include "math_config.h"
/* Table with 4/PI to 192 bit precision. To avoid unaligned accesses
only 8 new bits are added per entry, making the table 4 times larger. */
@@ -66,5 +31,3 @@ const uint32_t __inv_pio4[24] =
0x34ddc0db, 0xddc0db62, 0xc0db6295, 0xdb629599,
0x6295993c, 0x95993c43, 0x993c4390, 0x3c439041
};
-
-#include <sysdeps/ieee754/flt-32/s_sincosf_data_generic.c>
deleted file mode 100644
@@ -1,95 +0,0 @@
-/* Used by sinf, cosf and sincosf functions.
- Copyright (C) 2018-2026 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
- <https://www.gnu.org/licenses/>. */
-
-#include <stdint.h>
-#include <math.h>
-#include "math_config.h"
-#include <sincosf_poly.h>
-
-/* 2PI * 2^-64. */
-static const double pi63 = 0x1.921FB54442D18p-62;
-/* PI / 4. */
-static const float pio4 = 0x1.921FB6p-1f;
-
-/* Polynomial data (the cosine polynomial is negated in the 2nd entry). */
-extern const sincos_t __sincosf_table[2] attribute_hidden;
-
-/* Table with 4/PI to 192 bit precision. */
-extern const uint32_t __inv_pio4[] attribute_hidden;
-
-/* Top 12 bits of the float representation with the sign bit cleared. */
-static inline uint32_t
-abstop12 (float x)
-{
- return (asuint (x) >> 20) & 0x7ff;
-}
-
-/* Fast range reduction using single multiply-subtract. Return the modulo of
- X as a value between -PI/4 and PI/4 and store the quadrant in NP.
- The values for PI/2 and 2/PI are accessed via P. Since PI/2 as a double
- is accurate to 55 bits and the worst-case cancellation happens at 6 * PI/4,
- the result is accurate for |X| <= 120.0. */
-static inline double
-reduce_fast (double x, const sincos_t *p, int *np)
-{
- double r;
-#if TOINT_INTRINSICS
- /* Use fast round and lround instructions when available. */
- r = x * p->hpi_inv;
- *np = converttoint (r);
- return x - roundtoint (r) * p->hpi;
-#else
- /* Use scaled float to int conversion with explicit rounding.
- hpi_inv is prescaled by 2^24 so the quadrant ends up in bits 24..31.
- This avoids inaccuracies introduced by truncating negative values. */
- r = x * p->hpi_inv;
- int n = ((int32_t)r + 0x800000) >> 24;
- *np = n;
- return x - n * p->hpi;
-#endif
-}
-
-/* Reduce the range of XI to a multiple of PI/2 using fast integer arithmetic.
- XI is a reinterpreted float and must be >= 2.0f (the sign bit is ignored).
- Return the modulo between -PI/4 and PI/4 and store the quadrant in NP.
- Reduction uses a table of 4/PI with 192 bits of precision. A 32x96->128 bit
- multiply computes the exact 2.62-bit fixed-point modulo. Since the result
- can have at most 29 leading zeros after the binary point, the double
- precision result is accurate to 33 bits. */
-static inline double
-reduce_large (uint32_t xi, int *np)
-{
- const uint32_t *arr = &__inv_pio4[(xi >> 26) & 15];
- int shift = (xi >> 23) & 7;
- uint64_t n, res0, res1, res2;
-
- xi = (xi & 0xffffff) | 0x800000;
- xi <<= shift;
-
- res0 = xi * arr[0];
- res1 = (uint64_t)xi * arr[4];
- res2 = (uint64_t)xi * arr[8];
- res0 = (res2 >> 32) | (res0 << 32);
- res0 += res1;
-
- n = (res0 + (1ULL << 61)) >> 62;
- res0 -= n << 62;
- double x = (int64_t)res0;
- *np = n;
- return x * pi63;
-}
@@ -1,76 +1,103 @@
-/* Compute sine and cosine of argument.
- Copyright (C) 2018-2026 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/* Correctly-rounded sine of binary32 value.
+
+Copyright (c) 2022-2026 Alexei Sibidanov.
+
+The original version of this file was copied from the CORE-MATH
+project (file src/binary32/cosh/coshf.c, revision 8ea8ea35.
- 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.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
- 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.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
-#include <stdint.h>
-#include <math.h>
-#include "math_config.h"
-#include "s_sincosf.h"
+#include <s_sincosf_data.h>
-/* The constants and polynomials for sine and cosine. The 2nd entry
- computes -cos (x) rather than cos (x) to get negation for free. */
-const sincos_t __sincosf_table[2] =
+const uint64_t __sinf_ipi[] =
{
- {
- { 1.0, -1.0, -1.0, 1.0 },
-#if TOINT_INTRINSICS
- 0x1.45F306DC9C883p-1,
-#else
- 0x1.45F306DC9C883p+23,
-#endif
- 0x1.921FB54442D18p0,
- 0x1p0,
- -0x1.ffffffd0c621cp-2,
- 0x1.55553e1068f19p-5,
- -0x1.6c087e89a359dp-10,
- 0x1.99343027bf8c3p-16,
- -0x1.555545995a603p-3,
- 0x1.1107605230bc4p-7,
- -0x1.994eb3774cf24p-13
- },
- {
- { 1.0, -1.0, -1.0, 1.0 },
-#if TOINT_INTRINSICS
- 0x1.45F306DC9C883p-1,
-#else
- 0x1.45F306DC9C883p+23,
-#endif
- 0x1.921FB54442D18p0,
- -0x1p0,
- 0x1.ffffffd0c621cp-2,
- -0x1.55553e1068f19p-5,
- 0x1.6c087e89a359dp-10,
- -0x1.99343027bf8c3p-16,
- -0x1.555545995a603p-3,
- 0x1.1107605230bc4p-7,
- -0x1.994eb3774cf24p-13
- }
+ 0xfe5163abdebbc562, 0xdb6295993c439041, 0xfc2757d1f534ddc0,
+ 0xa2f9836e4e441529
};
-/* Table with 4/PI to 192 bit precision. To avoid unaligned accesses
- only 8 new bits are added per entry, making the table 4 times larger. */
-const uint32_t __inv_pio4[24] =
+const double __sinf_b[] =
{
- 0xa2, 0xa2f9, 0xa2f983, 0xa2f9836e,
- 0xf9836e4e, 0x836e4e44, 0x6e4e4415, 0x4e441529,
- 0x441529fc, 0x1529fc27, 0x29fc2757, 0xfc2757d1,
- 0x2757d1f5, 0x57d1f534, 0xd1f534dd, 0xf534ddc0,
- 0x34ddc0db, 0xddc0db62, 0xc0db6295, 0xdb629599,
- 0x6295993c, 0x95993c43, 0x993c4390, 0x3c439041
+ 0x1.3bd3cc9be45dcp-6, -0x1.03c1f081b0833p-14, 0x1.55d3c6fc9ac1fp-24,
+ -0x1.e1d3ff281b40dp-35
+};
+const double __sinf_a[] =
+{
+ 0x1.921fb54442d17p-3, -0x1.4abbce6256a39p-10, 0x1.466bc5a518c16p-19,
+ -0x1.32bdc61074ff6p-29
+};
+const double __sinf_tb[] =
+{
+ 0x0p+0, 0x1.8f8b83c69a60bp-3, 0x1.87de2a6aea963p-2,
+ 0x1.1c73b39ae68c8p-1, 0x1.6a09e667f3bcdp-1, 0x1.a9b66290ea1a3p-1,
+ 0x1.d906bcf328d46p-1, 0x1.f6297cff75cbp-1, 0x1p+0,
+ 0x1.f6297cff75cbp-1, 0x1.d906bcf328d46p-1, 0x1.a9b66290ea1a3p-1,
+ 0x1.6a09e667f3bcdp-1, 0x1.1c73b39ae68c8p-1, 0x1.87de2a6aea963p-2,
+ 0x1.8f8b83c69a60bp-3, 0x0p+0, -0x1.8f8b83c69a60bp-3,
+ -0x1.87de2a6aea963p-2, -0x1.1c73b39ae68c8p-1, -0x1.6a09e667f3bcdp-1,
+ -0x1.a9b66290ea1a3p-1, -0x1.d906bcf328d46p-1, -0x1.f6297cff75cbp-1,
+ -0x1p+0, -0x1.f6297cff75cbp-1, -0x1.d906bcf328d46p-1,
+ -0x1.a9b66290ea1a3p-1, -0x1.6a09e667f3bcdp-1, -0x1.1c73b39ae68c8p-1,
+ -0x1.87de2a6aea963p-2, -0x1.8f8b83c69a60bp-3
};
-#include <sysdeps/ieee754/flt-32/s_sincosf_data_generic.c>
+const double __cosf_tb[] =
+{
+ 0x1p+0, 0x1.f6297cff75cbp-1, 0x1.d906bcf328d46p-1,
+ 0x1.a9b66290ea1a3p-1, 0x1.6a09e667f3bcdp-1, 0x1.1c73b39ae68c8p-1,
+ 0x1.87de2a6aea963p-2, 0x1.8f8b83c69a60bp-3, 0x0p+0,
+ -0x1.8f8b83c69a60bp-3, -0x1.87de2a6aea963p-2, -0x1.1c73b39ae68c8p-1,
+ -0x1.6a09e667f3bcdp-1, -0x1.a9b66290ea1a3p-1, -0x1.d906bcf328d46p-1,
+ -0x1.f6297cff75cbp-1, -0x1p+0, -0x1.f6297cff75cbp-1,
+ -0x1.d906bcf328d46p-1, -0x1.a9b66290ea1a3p-1, -0x1.6a09e667f3bcdp-1,
+ -0x1.1c73b39ae68c8p-1, -0x1.87de2a6aea963p-2, -0x1.8f8b83c69a60bp-3,
+ 0x0p+0, 0x1.8f8b83c69a60bp-3, 0x1.87de2a6aea963p-2,
+ 0x1.1c73b39ae68c8p-1, 0x1.6a09e667f3bcdp-1, 0x1.a9b66290ea1a3p-1,
+ 0x1.d906bcf328d46p-1, 0x1.f6297cff75cbp-1
+};
+
+const sincosf_database_t __sinf_st[] =
+{
+ { { 0x1.33333p+13 }, -0x1.63f4bap-2, -0x1p-27 },
+ { { 0x1.75b8a2p-1 }, 0x1.55688ap-1, -0x1p-26 },
+ { { 0x1.4f0654p+0 }, 0x1.ee836cp-1, -0x1p-26 },
+ { { 0x1.2d97c8p+3 }, -0x1.99bc5ap-26, -0x1p-51 },
+};
+
+const sincosf_database_t __cosf_st[] =
+{
+ { { 0x1.2d97c8p+2 }, 0x1.99bc5cp-27, -0x1p-52 },
+ { { 0x1.4555p+51 }, 0x1.115d7ep-1, -0x1p-26 },
+ { { 0x1.48a858p+54 }, 0x1.f48148p-2, 0x1p-27 },
+ { { 0x1.3170fp+63 }, 0x1.fe2976p-1, 0x1p-26 },
+ { { 0x1.2b9622p+67 }, 0x1.f0285ep-1, -0x1p-26 },
+};
+
+const sincosf2_database_t __sincosf_st[] =
+{
+ { { 0x1.33333p+13 }, -0x1.63f4bap-2, -0x1p-27, -0x1.e01216p-1, -0x1p-26 },
+ { { 0x1.75b8a2p-1 }, 0x1.55688ap-1, -0x1p-26, 0x1.7d8e1ep-1, 0x1p-26 },
+ { { 0x1.4f0654p+0 }, 0x1.ee836cp-1, -0x1p-26, 0x1.09558p-2, -0x1p-27 },
+ { { 0x1.2d97c8p+3 }, -0x1.99bc5ap-26, -0x1p-51, -0x1p+0, 0x1p-25 },
+ { { 0x1.2d97c8p+2 }, -0x1p+0, 0x1p-25, 0x1.99bc5cp-27, -0x1p-52 },
+ { { 0x1.4555p+51 }, -0x1.b0ea44p-1, 0x1p-26, 0x1.115d7ep-1, -0x1p-26 },
+ { { 0x1.48a858p+54 }, 0x1.beac8cp-1, 0x1p-26, 0x1.f48148p-2, 0x1p-27 },
+ { { 0x1.3170fp+63 }, 0x1.5ac1eep-4, -0x1p-30, 0x1.fe2976p-1, 0x1p-26 },
+ { { 0x1.2b9622p+67 }, -0x1.f983c2p-3, 0x1p-28, 0x1.f0285ep-1, -0x1p-26 },
+};
@@ -19,6 +19,8 @@
#ifndef _S_SINCOSF_DATA_H
#define _S_SINCOSF_DATA_H
+#include <stdint.h>
+
extern const uint64_t __sinf_ipi[] attribute_hidden;
#define IPI __sinf_ipi
deleted file mode 100644
@@ -1,103 +0,0 @@
-/* Correctly-rounded sine of binary32 value.
-
-Copyright (c) 2022-2026 Alexei Sibidanov.
-
-The original version of this file was copied from the CORE-MATH
-project (file src/binary32/cosh/coshf.c, revision 8ea8ea35.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-#include <s_sincosf_data.h>
-
-const uint64_t __sinf_ipi[] =
-{
- 0xfe5163abdebbc562, 0xdb6295993c439041, 0xfc2757d1f534ddc0,
- 0xa2f9836e4e441529
-};
-
-const double __sinf_b[] =
-{
- 0x1.3bd3cc9be45dcp-6, -0x1.03c1f081b0833p-14, 0x1.55d3c6fc9ac1fp-24,
- -0x1.e1d3ff281b40dp-35
-};
-const double __sinf_a[] =
-{
- 0x1.921fb54442d17p-3, -0x1.4abbce6256a39p-10, 0x1.466bc5a518c16p-19,
- -0x1.32bdc61074ff6p-29
-};
-const double __sinf_tb[] =
-{
- 0x0p+0, 0x1.8f8b83c69a60bp-3, 0x1.87de2a6aea963p-2,
- 0x1.1c73b39ae68c8p-1, 0x1.6a09e667f3bcdp-1, 0x1.a9b66290ea1a3p-1,
- 0x1.d906bcf328d46p-1, 0x1.f6297cff75cbp-1, 0x1p+0,
- 0x1.f6297cff75cbp-1, 0x1.d906bcf328d46p-1, 0x1.a9b66290ea1a3p-1,
- 0x1.6a09e667f3bcdp-1, 0x1.1c73b39ae68c8p-1, 0x1.87de2a6aea963p-2,
- 0x1.8f8b83c69a60bp-3, 0x0p+0, -0x1.8f8b83c69a60bp-3,
- -0x1.87de2a6aea963p-2, -0x1.1c73b39ae68c8p-1, -0x1.6a09e667f3bcdp-1,
- -0x1.a9b66290ea1a3p-1, -0x1.d906bcf328d46p-1, -0x1.f6297cff75cbp-1,
- -0x1p+0, -0x1.f6297cff75cbp-1, -0x1.d906bcf328d46p-1,
- -0x1.a9b66290ea1a3p-1, -0x1.6a09e667f3bcdp-1, -0x1.1c73b39ae68c8p-1,
- -0x1.87de2a6aea963p-2, -0x1.8f8b83c69a60bp-3
-};
-
-const double __cosf_tb[] =
-{
- 0x1p+0, 0x1.f6297cff75cbp-1, 0x1.d906bcf328d46p-1,
- 0x1.a9b66290ea1a3p-1, 0x1.6a09e667f3bcdp-1, 0x1.1c73b39ae68c8p-1,
- 0x1.87de2a6aea963p-2, 0x1.8f8b83c69a60bp-3, 0x0p+0,
- -0x1.8f8b83c69a60bp-3, -0x1.87de2a6aea963p-2, -0x1.1c73b39ae68c8p-1,
- -0x1.6a09e667f3bcdp-1, -0x1.a9b66290ea1a3p-1, -0x1.d906bcf328d46p-1,
- -0x1.f6297cff75cbp-1, -0x1p+0, -0x1.f6297cff75cbp-1,
- -0x1.d906bcf328d46p-1, -0x1.a9b66290ea1a3p-1, -0x1.6a09e667f3bcdp-1,
- -0x1.1c73b39ae68c8p-1, -0x1.87de2a6aea963p-2, -0x1.8f8b83c69a60bp-3,
- 0x0p+0, 0x1.8f8b83c69a60bp-3, 0x1.87de2a6aea963p-2,
- 0x1.1c73b39ae68c8p-1, 0x1.6a09e667f3bcdp-1, 0x1.a9b66290ea1a3p-1,
- 0x1.d906bcf328d46p-1, 0x1.f6297cff75cbp-1
-};
-
-const sincosf_database_t __sinf_st[] =
-{
- { { 0x1.33333p+13 }, -0x1.63f4bap-2, -0x1p-27 },
- { { 0x1.75b8a2p-1 }, 0x1.55688ap-1, -0x1p-26 },
- { { 0x1.4f0654p+0 }, 0x1.ee836cp-1, -0x1p-26 },
- { { 0x1.2d97c8p+3 }, -0x1.99bc5ap-26, -0x1p-51 },
-};
-
-const sincosf_database_t __cosf_st[] =
-{
- { { 0x1.2d97c8p+2 }, 0x1.99bc5cp-27, -0x1p-52 },
- { { 0x1.4555p+51 }, 0x1.115d7ep-1, -0x1p-26 },
- { { 0x1.48a858p+54 }, 0x1.f48148p-2, 0x1p-27 },
- { { 0x1.3170fp+63 }, 0x1.fe2976p-1, 0x1p-26 },
- { { 0x1.2b9622p+67 }, 0x1.f0285ep-1, -0x1p-26 },
-};
-
-const sincosf2_database_t __sincosf_st[] =
-{
- { { 0x1.33333p+13 }, -0x1.63f4bap-2, -0x1p-27, -0x1.e01216p-1, -0x1p-26 },
- { { 0x1.75b8a2p-1 }, 0x1.55688ap-1, -0x1p-26, 0x1.7d8e1ep-1, 0x1p-26 },
- { { 0x1.4f0654p+0 }, 0x1.ee836cp-1, -0x1p-26, 0x1.09558p-2, -0x1p-27 },
- { { 0x1.2d97c8p+3 }, -0x1.99bc5ap-26, -0x1p-51, -0x1p+0, 0x1p-25 },
- { { 0x1.2d97c8p+2 }, -0x1p+0, 0x1p-25, 0x1.99bc5cp-27, -0x1p-52 },
- { { 0x1.4555p+51 }, -0x1.b0ea44p-1, 0x1p-26, 0x1.115d7ep-1, -0x1p-26 },
- { { 0x1.48a858p+54 }, 0x1.beac8cp-1, 0x1p-26, 0x1.f48148p-2, 0x1p-27 },
- { { 0x1.3170fp+63 }, 0x1.5ac1eep-4, -0x1p-30, 0x1.fe2976p-1, 0x1p-26 },
- { { 0x1.2b9622p+67 }, -0x1.f983c2p-3, 0x1p-28, 0x1.f0285ep-1, -0x1p-26 },
-};
deleted file mode 100644
@@ -1,87 +0,0 @@
-/* Used by sinf, cosf and sincosf functions.
- Copyright (C) 2018-2026 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
- <https://www.gnu.org/licenses/>. */
-
-/* The constants and polynomials for sine and cosine. */
-typedef struct
-{
- double sign[4]; /* Sign of sine in quadrants 0..3. */
- double hpi_inv; /* 2 / PI ( * 2^24 if !TOINT_INTRINSICS). */
- double hpi; /* PI / 2. */
- double c0, c1, c2, c3, c4; /* Cosine polynomial. */
- double s1, s2, s3; /* Sine polynomial. */
-} sincos_t;
-
-/* Compute the sine and cosine of inputs X and X2 (X squared), using the
- polynomial P and store the results in SINP and COSP. N is the quadrant,
- if odd the cosine and sine polynomials are swapped. */
-static inline void
-sincosf_poly (double x, double x2, const sincos_t *p, int n, float *sinp,
- float *cosp)
-{
- double x3, x4, x5, x6, s, c, c1, c2, s1;
-
- x4 = x2 * x2;
- x3 = x2 * x;
- c2 = p->c3 + x2 * p->c4;
- s1 = p->s2 + x2 * p->s3;
-
- /* Swap sin/cos result based on quadrant. */
- float *tmp = (n & 1 ? cosp : sinp);
- cosp = (n & 1 ? sinp : cosp);
- sinp = tmp;
-
- c1 = p->c0 + x2 * p->c1;
- x5 = x3 * x2;
- x6 = x4 * x2;
-
- s = x + x3 * p->s1;
- c = c1 + x4 * p->c2;
-
- *sinp = s + x5 * s1;
- *cosp = c + x6 * c2;
-}
-
-/* Return the sine of inputs X and X2 (X squared) using the polynomial P.
- N is the quadrant, and if odd the cosine polynomial is used. */
-static inline float
-sinf_poly (double x, double x2, const sincos_t *p, int n)
-{
- double x3, x4, x6, x7, s, c, c1, c2, s1;
-
- if ((n & 1) == 0)
- {
- x3 = x * x2;
- s1 = p->s2 + x2 * p->s3;
-
- x7 = x3 * x2;
- s = x + x3 * p->s1;
-
- return s + x7 * s1;
- }
- else
- {
- x4 = x2 * x2;
- c2 = p->c3 + x2 * p->c4;
- c1 = p->c0 + x2 * p->c1;
-
- x6 = x4 * x2;
- c = c1 + x4 * p->c2;
-
- return c + x6 * c2;
- }
-}
deleted file mode 100644
@@ -1,111 +0,0 @@
-/* Used by sinf, cosf and sincosf functions. X86-64 version.
- Copyright (C) 2018-2026 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
- <https://www.gnu.org/licenses/>. */
-
-typedef double v2df_t __attribute__ ((vector_size (2 * sizeof (double))));
-
-#ifdef __SSE2_MATH__
-typedef float v4sf_t __attribute__ ((vector_size (4 * sizeof (float))));
-
-static inline void
-v2df_to_sf (v2df_t v2df, float *f0p, float *f1p)
-{
- v4sf_t v4sf = __builtin_ia32_cvtpd2ps (v2df);
- *f0p = v4sf[0];
- *f1p = v4sf[1];
-}
-#else
-static inline void
-v2df_to_sf (v2df_t v2df, float *f0p, float *f1p)
-{
- *f0p = (float) v2df[0];
- *f1p = (float) v2df[1];
-}
-#endif
-
-/* The constants and polynomials for sine and cosine. */
-typedef struct
-{
- double sign[4]; /* Sign of sine in quadrants 0..3. */
- double hpi_inv; /* 2 / PI ( * 2^24 if !TOINT_INTRINSICS). */
- double hpi; /* PI / 2. */
- /* Cosine polynomial: c0, c1, c2, c3, c4.
- Sine polynomial: s1, s2, s3. */
- double c0, c1;
- v2df_t s1c2, s2c3, s3c4;
-} sincos_t;
-
-/* Compute the sine and cosine of inputs X and X2 (X squared), using the
- polynomial P and store the results in SINP and COSP. N is the quadrant,
- if odd the cosine and sine polynomials are swapped. */
-static inline void
-sincosf_poly (double x, double x2, const sincos_t *p, int n, float *sinp,
- float *cosp)
-{
- v2df_t vx2x2 = { x2, x2 };
- v2df_t vxx2 = { x, x2 };
- v2df_t vx3x4, vs1c2;
-
- vx3x4 = vx2x2 * vxx2;
- vs1c2 = p->s2c3 + vx2x2 * p->s3c4;
-
- /* Swap sin/cos result based on quadrant. */
- if (n & 1)
- {
- float *tmp = cosp;
- cosp = sinp;
- sinp = tmp;
- }
-
- double c1 = p->c0 + x2 * p->c1;
- v2df_t vxc1 = { x, c1 };
- v2df_t vx5x6 = vx3x4 * vx2x2;
-
- v2df_t vsincos = vxc1 + vx3x4 * p->s1c2;
- vsincos = vsincos + vx5x6 * vs1c2;
- v2df_to_sf (vsincos, sinp, cosp);
-}
-
-/* Return the sine of inputs X and X2 (X squared) using the polynomial P.
- N is the quadrant, and if odd the cosine polynomial is used. */
-static inline float
-sinf_poly (double x, double x2, const sincos_t *p, int n)
-{
- double x3, x4, x6, x7, s, c, c1, c2, s1;
-
- if ((n & 1) == 0)
- {
- x3 = x * x2;
- s1 = p->s2c3[0] + x2 * p->s3c4[0];
-
- x7 = x3 * x2;
- s = x + x3 * p->s1c2[0];
-
- return s + x7 * s1;
- }
- else
- {
- x4 = x2 * x2;
- c2 = p->s2c3[1] + x2 * p->s3c4[1];
- c1 = p->c0 + x2 * p->c1;
-
- x6 = x4 * x2;
- c = c1 + x4 * p->s1c2[1];
-
- return c + x6 * c2;
- }
-}