Skip to content

Commit 15b9380

Browse files
committed
[libc] Change sinf range reduction to mod pi/16 to be shared with cosf.
Change `sinf` range reduction to mod pi/16 to be shared with `cosf`. Previously, `sinf` used range reduction `mod pi`, but this cannot be used to implement `cosf` since the minimax algorithm for `cosf` does not converge due to critical points at `pi/2`. In order to be able to share the same range reduction functions for both `sinf` and `cosf`, we change the range reduction to `mod pi/16` for the following reasons: - The table size is sufficiently small: 32 entries for `sin(k * pi/16)` with `k = 0..31`. It could be reduced to 16 entries if we treat the final sign separately, with an extra multiplication at the end. - The polynomials' degrees are reduced to 7/8 from 15, with extra computations to combine `sin` and `cos` with trig sum equality. - The number of exceptional cases reduced to 2 (with FMA) and 3 (without FMA). - The latency is reduced while maintaining similar throughput as before. Reviewed By: zimmermann6 Differential Revision: https://reviews.llvm.org/D130629
1 parent 77ccf63 commit 15b9380

File tree

8 files changed

+169
-206
lines changed

8 files changed

+169
-206
lines changed

libc/docs/math.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ Performance
223223
+--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+------------+-------------------------+--------------+---------------+
224224
| log2f | 13 | 10 | 57 | 46 | :math:`[e^{-1}, e]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA |
225225
+--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+------------+-------------------------+--------------+---------------+
226-
| sinf | 14 | 26 | 65 | 59 | :math:`[-\pi, \pi]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA |
226+
| sinf | 13 | 25 | 54 | 57 | :math:`[-\pi, \pi]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA |
227227
+--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+------------+-------------------------+--------------+---------------+
228228

229229
References

libc/src/math/generic/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ add_entrypoint_object(
7979
range_reduction.h
8080
range_reduction_fma.h
8181
DEPENDS
82+
.common_constants
8283
libc.include.math
8384
libc.src.errno.errno
8485
libc.src.__support.FPUtil.fputil

libc/src/math/generic/common_constants.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,21 @@ const double EXP_M2[128] = {
226226
0x1.568bb722dd593p1, 0x1.593b7d72305bbp1,
227227
};
228228

229+
// Lookup table for sin(k * pi / 16) with k = 0, ..., 31.
230+
// Table is generated with Sollya as follow:
231+
// > display = hexadecimal;
232+
// > for k from 0 to 31 do { D(sin(k * pi/16)); };
233+
const double SIN_K_PI_OVER_16[32] = {
234+
0x0.0000000000000p+0, 0x1.8f8b83c69a60bp-3, 0x1.87de2a6aea963p-2,
235+
0x1.1c73b39ae68c8p-1, 0x1.6a09e667f3bcdp-1, 0x1.a9b66290ea1a3p-1,
236+
0x1.d906bcf328d46p-1, 0x1.f6297cff75cb0p-1, 0x1.0000000000000p+0,
237+
0x1.f6297cff75cb0p-1, 0x1.d906bcf328d46p-1, 0x1.a9b66290ea1a3p-1,
238+
0x1.6a09e667f3bcdp-1, 0x1.1c73b39ae68c8p-1, 0x1.87de2a6aea963p-2,
239+
0x1.8f8b83c69a60bp-3, 0x0.0000000000000p+0, -0x1.8f8b83c69a60bp-3,
240+
-0x1.87de2a6aea963p-2, -0x1.1c73b39ae68c8p-1, -0x1.6a09e667f3bcdp-1,
241+
-0x1.a9b66290ea1a3p-1, -0x1.d906bcf328d46p-1, -0x1.f6297cff75cb0p-1,
242+
-0x1.0000000000000p+0, -0x1.f6297cff75cb0p-1, -0x1.d906bcf328d46p-1,
243+
-0x1.a9b66290ea1a3p-1, -0x1.6a09e667f3bcdp-1, -0x1.1c73b39ae68c8p-1,
244+
-0x1.87de2a6aea963p-2, -0x1.8f8b83c69a60bp-3};
245+
229246
} // namespace __llvm_libc

libc/src/math/generic/common_constants.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ extern const double EXP_M1[195];
3131
// > for i from 0 to 127 do { D(exp(i / 128)); };
3232
extern const double EXP_M2[128];
3333

34+
// Lookup table for sin(k * pi / 16) with k = 0, ..., 31.
35+
// Table is generated with Sollya as follow:
36+
// > display = hexadecimal;
37+
// > for k from 0 to 31 do { D(sin(k * pi/16)); };
38+
extern const double SIN_K_PI_OVER_16[32];
39+
3440
} // namespace __llvm_libc
3541

3642
#endif // LLVM_LIBC_SRC_MATH_GENERIC_COMMON_CONSTANTS_H

libc/src/math/generic/range_reduction.h

Lines changed: 37 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,110 +18,85 @@ namespace __llvm_libc {
1818

1919
namespace generic {
2020

21-
static constexpr uint32_t FAST_PASS_BOUND = 0x4c80'0000U; // 2^26
21+
static constexpr uint32_t FAST_PASS_BOUND = 0x4a80'0000U; // 2^22
2222

2323
static constexpr int N_ENTRIES = 8;
2424

25-
// We choose to split bits of 1/pi into 28-bit precision pieces, so that the
26-
// product of x * ONE_OVER_PI_28[i] is exact.
25+
// We choose to split bits of 16/pi into 28-bit precision pieces, so that the
26+
// product of x * SIXTEEN_OVER_PI_28[i] is exact.
2727
// These are generated by Sollya with:
28-
// > a1 = D(round(1/pi, 28, RN)); a1;
29-
// > a2 = D(round(1/pi - a1, 28, RN)); a2;
30-
// > a3 = D(round(1/pi - a1 - a2, 28, RN)); a3;
31-
// > a4 = D(round(1/pi - a1 - a2 - a3, 28, RN)); a4;
28+
// > a1 = D(round(16/pi, 28, RN)); a1;
29+
// > a2 = D(round(16/pi - a1, 28, RN)); a2;
30+
// > a3 = D(round(16/pi - a1 - a2, 28, RN)); a3;
31+
// > a4 = D(round(16/pi - a1 - a2 - a3, 28, RN)); a4;
3232
// ...
33-
static constexpr double ONE_OVER_PI_28[N_ENTRIES] = {
34-
0x1.45f306ep-2, -0x1.b1bbeaep-33, 0x1.3f84ebp-62, -0x1.7056592p-92,
35-
0x1.c0db62ap-121, -0x1.4cd8778p-150, -0x1.bef806cp-179, 0x1.63abdecp-209};
33+
static constexpr double SIXTEEN_OVER_PI_28[N_ENTRIES] = {
34+
0x1.45f306ep+2, -0x1.b1bbeaep-29, 0x1.3f84ebp-58, -0x1.7056592p-88,
35+
0x1.c0db62ap-117, -0x1.4cd8778p-146, -0x1.bef806cp-175, 0x1.63abdecp-205};
3636

3737
// Exponents of the least significant bits of the corresponding entries in
38-
// ONE_OVER_PI_28.
39-
static constexpr int ONE_OVER_PI_28_LSB_EXP[N_ENTRIES] = {
40-
-29, -60, -86, -119, -148, -175, -205, -235};
38+
// SIXTEEN_OVER_PI_28.
39+
static constexpr int SIXTEEN_OVER_PI_28_LSB_EXP[N_ENTRIES] = {
40+
-25, -56, -82, -115, -144, -171, -201, -231};
4141

42-
// Return (k mod 2) and y, where
43-
// k = round(x / pi) and y = (x / pi) - k.
42+
// Return k and y, where
43+
// k = round(x * 16 / pi) and y = (x * 16 / pi) - k.
4444
static inline int64_t small_range_reduction(double x, double &y) {
45-
double prod = x * ONE_OVER_PI_28[0];
45+
double prod = x * SIXTEEN_OVER_PI_28[0];
4646
double kd = fputil::nearest_integer(prod);
4747
y = prod - kd;
48-
y = fputil::multiply_add(x, ONE_OVER_PI_28[1], y);
49-
y = fputil::multiply_add(x, ONE_OVER_PI_28[2], y);
48+
y = fputil::multiply_add(x, SIXTEEN_OVER_PI_28[1], y);
49+
y = fputil::multiply_add(x, SIXTEEN_OVER_PI_28[2], y);
5050
return static_cast<int64_t>(kd);
5151
}
5252

5353
// Return k and y, where
54-
// k = round(x / pi) and y = (x / pi) - k.
55-
// For large range, there are at most 2 parts of ONE_OVER_PI_28 contributing to
56-
// the unit binary digit (k & 1). If the least significant bit of x * the least
57-
// significant bit of ONE_OVER_PI_28[i] > 1, we can completely ignore
58-
// ONE_OVER_PI_28[i].
54+
// k = round(x * 16 / pi) and y = (x * 16 / pi) - k.
55+
// For large range, there are at most 2 parts of SIXTEEN_OVER_PI_28 contributing
56+
// to the lowest 5 binary digits (k & 31). If the least significant bit of
57+
// x * the least significant bit of SIXTEEN_OVER_PI_28[i] >= 32, we can
58+
// completely ignore SIXTEEN_OVER_PI_28[i].
5959
static inline int64_t large_range_reduction(double x, int x_exp, double &y) {
6060
int idx = 0;
6161
y = 0;
62-
int x_lsb_exp = x_exp - fputil::FloatProperties<float>::MANTISSA_WIDTH;
62+
int x_lsb_exp_m4 = x_exp - fputil::FloatProperties<float>::MANTISSA_WIDTH;
6363

64-
// Skipping the first parts of 1/pi such that:
65-
// LSB of x * LSB of ONE_OVER_PI_28[i] > 1.
66-
while (x_lsb_exp + ONE_OVER_PI_28_LSB_EXP[idx] > 0)
64+
// Skipping the first parts of 16/pi such that:
65+
// LSB of x * LSB of SIXTEEN_OVER_PI_28[i] >= 32.
66+
while (x_lsb_exp_m4 + SIXTEEN_OVER_PI_28_LSB_EXP[idx] > 4)
6767
++idx;
6868

69-
double prod_hi = x * ONE_OVER_PI_28[idx];
70-
// Get the integral part of x * ONE_OVER_PI_28[idx]
69+
double prod_hi = x * SIXTEEN_OVER_PI_28[idx];
70+
// Get the integral part of x * SIXTEEN_OVER_PI_28[idx]
7171
double k_hi = fputil::nearest_integer(prod_hi);
72-
// Get the fractional part of x * ONE_OVER_PI_28[idx]
72+
// Get the fractional part of x * SIXTEEN_OVER_PI_28[idx]
7373
double frac = prod_hi - k_hi;
74-
double prod_lo = fputil::multiply_add(x, ONE_OVER_PI_28[idx + 1], frac);
74+
double prod_lo = fputil::multiply_add(x, SIXTEEN_OVER_PI_28[idx + 1], frac);
7575
double k_lo = fputil::nearest_integer(prod_lo);
7676

7777
// Now y is the fractional parts.
7878
y = prod_lo - k_lo;
79-
y = fputil::multiply_add(x, ONE_OVER_PI_28[idx + 2], y);
80-
y = fputil::multiply_add(x, ONE_OVER_PI_28[idx + 3], y);
79+
y = fputil::multiply_add(x, SIXTEEN_OVER_PI_28[idx + 2], y);
80+
y = fputil::multiply_add(x, SIXTEEN_OVER_PI_28[idx + 3], y);
8181

82-
return static_cast<int64_t>(k_hi + k_lo);
82+
return static_cast<int64_t>(k_hi) + static_cast<int64_t>(k_lo);
8383
}
8484

8585
// Exceptional cases.
86-
static constexpr int N_EXCEPT_SMALL = 4;
86+
static constexpr int N_EXCEPTS = 3;
8787

88-
static constexpr fputil::ExceptionalValues<float, N_EXCEPT_SMALL> SmallExcepts{
88+
static constexpr fputil::ExceptionalValues<float, N_EXCEPTS> SinfExcepts{
8989
/* inputs */ {
9090
0x3fa7832a, // x = 0x1.4f0654p0
9191
0x46199998, // x = 0x1.33333p13
92-
0x4afdece4, // x = 0x1.fbd9c8p22
93-
0x4c2332e9, // x = 0x1.4665d2p25
92+
0x55cafb2a, // x = 0x1.95f654p44
9493
},
9594
/* outputs (RZ, RU offset, RD offset, RN offset) */
9695
{
9796
{0x3f7741b5, 1, 0, 1}, // x = 0x1.4f0654p0, sin(x) = 0x1.ee836ap-1 (RZ)
9897
{0xbeb1fa5d, 0, 1, 0}, // x = 0x1.33333p13, sin(x) = -0x1.63f4bap-2 (RZ)
99-
{0xbf7fb6e0, 0, 1, 1}, // x = 0x1.fbd9c8p22, sin(x) = -0x1.ff6dcp-1 (RZ)
100-
{0xbf7fffff, 0, 1,
101-
1}, // x = 0x1.4665d2p25, sin(x) = -0x1.fffffep-1 (RZ)
102-
}};
103-
104-
static constexpr int N_EXCEPT_LARGE = 5;
105-
106-
static constexpr fputil::ExceptionalValues<float, N_EXCEPT_LARGE> LargeExcepts{
107-
/* inputs */ {
108-
0x523947f6, // x = 0x1.728fecp37
109-
0x53b146a6, // x = 0x1.628d4cp40
110-
0x55cafb2a, // x = 0x1.95f654p44
111-
0x6a1976f1, // x = 0x1.32ede2p85
112-
0x77584625, // x = 0x1.b08c4ap111
113-
},
114-
/* outputs (RZ, RU offset, RD offset, RN offset) */
115-
{
116-
{0xbf12791d, 0, 1,
117-
1}, // x = 0x1.728fecp37, sin(x) = -0x1.24f23ap-1 (RZ)
118-
{0xbf7fffff, 0, 1,
119-
1}, // x = 0x1.628d4cp40, sin(x) = -0x1.fffffep-1 (RZ)
12098
{0xbf7e7a16, 0, 1,
12199
1}, // x = 0x1.95f654p44, sin(x) = -0x1.fcf42cp-1 (RZ)
122-
{0x3f7fffff, 1, 0, 1}, // x = 0x1.32ede2p85, sin(x) = 0x1.fffffep-1 (RZ)
123-
{0xbf7fffff, 0, 1,
124-
1}, // x = 0x1.b08c4ap111, sin(x) = -0x1.fffffep-1 (RZ)
125100
}};
126101

127102
} // namespace generic

libc/src/math/generic/range_reduction_fma.h

Lines changed: 43 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -18,118 +18,85 @@ namespace __llvm_libc {
1818

1919
namespace fma {
2020

21-
static constexpr uint32_t FAST_PASS_BOUND = 0x5880'0000U; // 2^50
21+
static constexpr uint32_t FAST_PASS_BOUND = 0x5680'0000U; // 2^46
2222

2323
// Digits of 1/pi, generated by Sollya with:
24-
// > a0 = D(1/pi);
25-
// > a1 = D(1/pi - a0);
26-
// > a2 = D(1/pi - a0 - a1);
27-
// > a3 = D(1/pi - a0 - a1 - a2);
28-
static constexpr double ONE_OVER_PI[5] = {
29-
0x1.45f306dc9c883p-2, -0x1.6b01ec5417056p-56, -0x1.6447e493ad4cep-110,
30-
0x1.e21c820ff28b2p-164, -0x1.508510ea79237p-219};
24+
// > a0 = D(16/pi);
25+
// > a1 = D(16/pi - a0);
26+
// > a2 = D(16/pi - a0 - a1);
27+
// > a3 = D(16/pi - a0 - a1 - a2);
28+
static constexpr double SIXTEEN_OVER_PI[5] = {
29+
0x1.45f306dc9c883p+2, -0x1.6b01ec5417056p-52, -0x1.6447e493ad4cep-106,
30+
0x1.e21c820ff28b2p-160, -0x1.508510ea79237p-215};
3131

3232
// Return k and y, where
33-
// k = round(x / pi) and y = (x / pi) - k.
33+
// k = round(x * 16 / pi) and y = (x * 16 / pi) - k.
3434
// Assume x is non-negative.
3535
static inline int64_t small_range_reduction(double x, double &y) {
36-
double kd = fputil::nearest_integer(x * ONE_OVER_PI[0]);
37-
y = fputil::fma(x, ONE_OVER_PI[0], -kd);
38-
y = fputil::fma(x, ONE_OVER_PI[1], y);
36+
double kd = fputil::nearest_integer(x * SIXTEEN_OVER_PI[0]);
37+
y = fputil::fma(x, SIXTEEN_OVER_PI[0], -kd);
38+
y = fputil::fma(x, SIXTEEN_OVER_PI[1], y);
3939
return static_cast<int64_t>(kd);
4040
}
4141

4242
// Return k and y, where
43-
// k = round(x / pi) and y = (x / pi) - k.
43+
// k = round(x * 16 / pi) and y = (x * 16 / pi) - k.
4444
static inline int64_t large_range_reduction(double x, int x_exp, double &y) {
45-
// 2^50 <= |x| < 2^104
46-
if (x_exp < 103) {
47-
// - When x < 2^104, the unit bit is contained in the full exact product of
48-
// x * ONE_OVER_PI[0].
49-
// - When 2^50 <= |x| < 2^55, the unit bit is contained
50-
// in the last 8 bits of double(x * ONE_OVER_PI[0]).
51-
// - When |x| >= 2^55, the LSB of double(x * ONE_OVER_PI[0]) is at least 2.
52-
fputil::FPBits<double> prod_hi(x * ONE_OVER_PI[0]);
53-
prod_hi.bits &= (x_exp < 55) ? (~0xffULL) : (~0ULL); // |x| < 2^55
45+
// 2^46 <= |x| < 2^99
46+
if (x_exp < 99) {
47+
// - When x < 2^99, the full exact product of x * SIXTEEN_OVER_PI[0]
48+
// contains at least one integral bit <= 2^4.
49+
// - When 2^46 <= |x| < 2^56, the lowest 5 unit bits are contained
50+
// in the last 10 bits of double(x * SIXTEEN_OVER_PI[0]).
51+
// - When |x| >= 2^56, the LSB of double(x * SIXTEEN_OVER_PI[0]) is at least
52+
// 32.
53+
fputil::FPBits<double> prod_hi(x * SIXTEEN_OVER_PI[0]);
54+
prod_hi.bits &= (x_exp < 56) ? (~0xfffULL) : (~0ULL); // |x| < 2^56
5455
double k_hi = fputil::nearest_integer(static_cast<double>(prod_hi));
55-
double truncated_prod = fputil::fma(x, ONE_OVER_PI[0], -k_hi);
56-
double prod_lo = fputil::fma(x, ONE_OVER_PI[1], truncated_prod);
56+
double truncated_prod = fputil::fma(x, SIXTEEN_OVER_PI[0], -k_hi);
57+
double prod_lo = fputil::fma(x, SIXTEEN_OVER_PI[1], truncated_prod);
5758
double k_lo = fputil::nearest_integer(prod_lo);
58-
y = fputil::fma(x, ONE_OVER_PI[1], truncated_prod - k_lo);
59-
y = fputil::fma(x, ONE_OVER_PI[2], y);
60-
y = fputil::fma(x, ONE_OVER_PI[3], y);
59+
y = fputil::fma(x, SIXTEEN_OVER_PI[1], truncated_prod - k_lo);
60+
y = fputil::fma(x, SIXTEEN_OVER_PI[2], y);
61+
y = fputil::fma(x, SIXTEEN_OVER_PI[3], y);
6162

6263
return static_cast<int64_t>(k_lo);
6364
}
6465

65-
// - When x >= 2^104, the full exact product of x * ONE_OVER_PI[0] does not
66-
// contain the unit bit, so we can ignore it completely.
67-
// - When 2^104 <= |x| < 2^109, the unit bit is contained
68-
// in the last 8 bits of double(x * ONE_OVER_PI[1]).
69-
// - When |x| >= 2^109, the LSB of double(x * ONE_OVER_PI[1]) is at least 2.
70-
fputil::FPBits<double> prod_hi(x * ONE_OVER_PI[1]);
71-
prod_hi.bits &= (x_exp < 109) ? (~0xffULL) : (~0ULL); // |x| < 2^55
66+
// - When x >= 2^110, the full exact product of x * SIXTEEN_OVER_PI[0] does
67+
// not contain any of the lowest 5 unit bits, so we can ignore it completely.
68+
// - When 2^99 <= |x| < 2^110, the lowest 5 unit bits are contained
69+
// in the last 12 bits of double(x * SIXTEEN_OVER_PI[1]).
70+
// - When |x| >= 2^110, the LSB of double(x * SIXTEEN_OVER_PI[1]) is at
71+
// least 32.
72+
fputil::FPBits<double> prod_hi(x * SIXTEEN_OVER_PI[1]);
73+
prod_hi.bits &= (x_exp < 110) ? (~0xfffULL) : (~0ULL); // |x| < 2^110
7274
double k_hi = fputil::nearest_integer(static_cast<double>(prod_hi));
73-
double truncated_prod = fputil::fma(x, ONE_OVER_PI[1], -k_hi);
74-
double prod_lo = fputil::fma(x, ONE_OVER_PI[2], truncated_prod);
75+
double truncated_prod = fputil::fma(x, SIXTEEN_OVER_PI[1], -k_hi);
76+
double prod_lo = fputil::fma(x, SIXTEEN_OVER_PI[2], truncated_prod);
7577
double k_lo = fputil::nearest_integer(prod_lo);
76-
y = fputil::fma(x, ONE_OVER_PI[2], truncated_prod - k_lo);
77-
y = fputil::fma(x, ONE_OVER_PI[3], y);
78-
y = fputil::fma(x, ONE_OVER_PI[4], y);
78+
y = fputil::fma(x, SIXTEEN_OVER_PI[2], truncated_prod - k_lo);
79+
y = fputil::fma(x, SIXTEEN_OVER_PI[3], y);
80+
y = fputil::fma(x, SIXTEEN_OVER_PI[4], y);
7981

8082
return static_cast<int64_t>(k_lo);
8183
}
8284

8385
// Exceptional cases.
84-
static constexpr int N_EXCEPT_SMALL = 9;
86+
static constexpr int N_EXCEPTS = 2;
8587

86-
static constexpr fputil::ExceptionalValues<float, N_EXCEPT_SMALL> SmallExcepts{
88+
static constexpr fputil::ExceptionalValues<float, N_EXCEPTS> SinfExcepts{
8789
/* inputs */ {
8890
0x3fa7832a, // x = 0x1.4f0654p0
89-
0x40171973, // x = 0x1.2e32e6p1
90-
0x4096cbe4, // x = 0x1.2d97c8p2
91-
0x433b7490, // x = 0x1.76e92p7
92-
0x437ce5f1, // x = 0x1.f9cbe2p7
93-
0x46199998, // x = 0x1.33333p13
94-
0x474d246f, // x = 0x1.9a48dep15
95-
0x4afdece4, // x = 0x1.fbd9c8p22
9691
0x55cafb2a, // x = 0x1.95f654p44
9792
},
9893
/* outputs (RZ, RU offset, RD offset, RN offset) */
9994
{
10095
{0x3f7741b5, 1, 0, 1}, // x = 0x1.4f0654p0, sin(x) = 0x1.ee836ap-1 (RZ)
101-
{0x3f34290f, 1, 0, 1}, // x = 0x1.2e32e6p1, sin(x) = 0x1.68521ep-1 (RZ)
102-
{0xbf7fffff, 0, 1, 1}, // x = 0x1.2d97c8p2, sin(x) = -0x1.fffffep-1 (RZ)
103-
{0xbf5cce62, 0, 1, 0}, // x = 0x1.76e92p7, sin(x) = -0x1.b99cc4p-1 (RZ)
104-
{0x3f7fffff, 1, 0, 1}, // x = 0x1.f9cbe2p7, sin(x) = 0x1.fffffep-1 (RZ)
105-
{0xbeb1fa5d, 0, 1, 0}, // x = 0x1.33333p13, sin(x) = -0x1.63f4bap-2 (RZ)
106-
{0x3f7fffff, 1, 0, 1}, // x = 0x1.9a48dep15, sin(x) = 0x1.fffffep-1 (RZ)
107-
{0xbf7fb6e0, 0, 1, 1}, // x = 0x1.fbd9c8p22, sin(x) = -0x1.ff6dcp-1 (RZ)
10896
{0xbf7e7a16, 0, 1,
10997
1}, // x = 0x1.95f654p44, sin(x) = -0x1.fcf42cp-1 (RZ)
11098
}};
11199

112-
static constexpr int N_EXCEPT_LARGE = 5;
113-
114-
static constexpr fputil::ExceptionalValues<float, N_EXCEPT_LARGE> LargeExcepts{
115-
/* inputs */ {
116-
0x5ebcfdde, // x = 0x1.79fbbcp62
117-
0x5fa6eba7, // x = 0x1.4dd74ep64
118-
0x6386134e, // x = 0x1.0c269cp72
119-
0x6a1976f1, // x = 0x1.32ede2p85
120-
0x727669d4, // x = 0x1.ecd3a8p101
121-
},
122-
/* outputs (RZ, RU offset, RD offset, RN offset) */
123-
{
124-
{0x3f50622d, 1, 0, 0}, // x = 0x1.79fbbcp62, sin(x) = 0x1.a0c45ap-1 (RZ)
125-
{0xbe52464a, 0, 1,
126-
0}, // x = 0x1.4dd74ep64, sin(x) = -0x1.a48c94p-3 (RZ)
127-
{0x3f7cb2e7, 1, 0, 0}, // x = 0x1.0c269cp72, sin(x) = 0x1.f965cep-1 (RZ)
128-
{0x3f7fffff, 1, 0, 1}, // x = 0x1.32ede2p85, sin(x) = 0x1.fffffep-1 (RZ)
129-
{0xbf7a781d, 0, 1,
130-
0}, // x = 0x1.ecd3a8p101, sin(x) = -0x1.f4f038p-1 (RZ)
131-
}};
132-
133100
} // namespace fma
134101

135102
} // namespace __llvm_libc

0 commit comments

Comments
 (0)