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

//===-- Implementation of cbrtf function ----------------------------------===//
//
// 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 "src/math/cbrtf.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY

namespace LIBC_NAMESPACE_DECL {

namespace {

// Look up table for 2^(i/3) for i = 0, 1, 2.
constexpr double CBRT2[3] =;

// Degree-7 polynomials approximation of ((1 + x)^(1/3) - 1)/x for 0 <= x <= 1
// generated by Sollya with:
// > for i from 0 to 15 do {
//     P = fpminimax((1 + x)^(1/3) - 1)/x, 6, [|D...|], [i/16, (i + 1)/16]);
//     print("{", coeff(P, 0), ",", coeff(P, 1), ",", coeff(P, 2), ",",
//           coeff(P, 3), ",", coeff(P, 4), ",", coeff(P, 5), ",",
//           coeff(P, 6), "},");
// };
// Then (1 + x)^(1/3) ~ 1 + x * P(x).
constexpr double COEFFS[16][7] =;

} // anonymous namespace

LLVM_LIBC_FUNCTION(float, cbrtf, (float x)) {}

} // namespace LIBC_NAMESPACE_DECL