llvm/libc/src/math/generic/inv_trigf_utils.cpp

//===-- Single-precision general exp/log functions ------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "inv_trigf_utils.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

// Polynomial approximation for 0 <= x <= 1:
//   atan(x) ~ atan((i/16) + (x - (i/16)) * Q(x - i/16)
//           = P(x - i/16)
// Generated by Sollya with:
// > for i from 1 to 16 do {
//     mid_point = i/16;
//     P = fpminimax(atan(mid_point + x), 8, [|D...|], [-1/32, 1/32]);
//     print("{", coeff(P, 0), ",", coeff(P, 1), ",", coeff(P, 2), ",",
//           coeff(P, 3), ",", coeff(P, 4), ",", coeff(P, 5), ",", coeff(P, 6),
//           ",", coeff(P, 7), ",", coeff(P, 8), "},");
//   };
// For i = 0, the polynomial is generated by:
// > P = fpminimax(atan(x)/x, 7, [|1, D...|], [0, 1/32]);
// > dirtyinfnorm((atan(x) - x*P)/x, [0, 1/32]);
//   0x1.feb2fcdba66447ccbe28a1a0f935b51678a718fb1p-59
// Notice that degree-7 is good enough for atanf, but degree-8 helps reduce the
// error bounds for atan2f's fast pass 16 times, and it does not affect the
// performance of atanf much.
double ATAN_COEFFS[17][9] =;

} // namespace LIBC_NAMESPACE_DECL