@@ -21,17 +21,6 @@ namespace LIBC_NAMESPACE_DECL {
2121constexpr int LOG_P1_BITS = 6 ;
2222constexpr int LOG_P1_SIZE = 1 << LOG_P1_BITS;
2323
24- // N[Table[Log[2, 1 + x], {x, 0/64, 63/64, 1/64}], 40]
25- extern const double LOG_P1_LOG2[LOG_P1_SIZE];
26-
27- // N[Table[1/(1 + x), {x, 0/64, 63/64, 1/64}], 40]
28- extern const double LOG_P1_1_OVER[LOG_P1_SIZE];
29-
30- // Taylor series expansion for Log[2, 1 + x] splitted to EVEN AND ODD numbers
31- // K_LOG2_ODD starts from x^3
32- extern const double K_LOG2_ODD[4 ];
33- extern const double K_LOG2_EVEN[4 ];
34-
3524// The function correctly calculates sinh(x) and cosh(x) by calculating exp(x)
3625// and exp(-x) simultaneously.
3726// To compute e^x, we perform the following range
@@ -131,33 +120,6 @@ template <bool is_sinh> LIBC_INLINE double exp_pm_eval(float x) {
131120 return r;
132121}
133122
134- // x should be positive, normal finite value
135- LIBC_INLINE static double log2_eval (double x) {
136- using FPB = fputil::FPBits<double >;
137- FPB bs (x);
138-
139- double result = 0 ;
140- result += bs.get_exponent ();
141-
142- int p1 = (bs.get_mantissa () >> (FPB::FRACTION_LEN - LOG_P1_BITS)) &
143- (LOG_P1_SIZE - 1 );
144-
145- bs.set_uintval (bs.uintval () & (FPB::FRACTION_MASK >> LOG_P1_BITS));
146- bs.set_biased_exponent (FPB::EXP_BIAS);
147- double dx = (bs.get_val () - 1.0 ) * LOG_P1_1_OVER[p1];
148-
149- // Taylor series for log(2,1+x)
150- double c1 = fputil::multiply_add (dx, K_LOG2_ODD[0 ], K_LOG2_EVEN[0 ]);
151- double c2 = fputil::multiply_add (dx, K_LOG2_ODD[1 ], K_LOG2_EVEN[1 ]);
152- double c3 = fputil::multiply_add (dx, K_LOG2_ODD[2 ], K_LOG2_EVEN[2 ]);
153- double c4 = fputil::multiply_add (dx, K_LOG2_ODD[3 ], K_LOG2_EVEN[3 ]);
154-
155- // c0 = dx * (1.0 / ln(2)) + LOG_P1_LOG2[p1]
156- double c0 = fputil::multiply_add (dx, 0x1 .71547652b82fep+0 , LOG_P1_LOG2[p1]);
157- result += LIBC_NAMESPACE::fputil::polyeval (dx * dx, c0, c1, c2, c3, c4);
158- return result;
159- }
160-
161123// x should be positive, normal finite value
162124// TODO: Simplify range reduction and polynomial degree for float16.
163125// See issue #137190.
0 commit comments