llvm/libc/src/math/generic/log_range_reduction.h

//===-- Extra range reduction steps for accurate pass of logarithms -------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_MATH_GENERIC_LOG_RANGE_REDUCTION_H
#define LLVM_LIBC_SRC_MATH_GENERIC_LOG_RANGE_REDUCTION_H

#include "common_constants.h"
#include "src/__support/FPUtil/dyadic_float.h"
#include "src/__support/macros/config.h"
#include "src/__support/uint128.h"

namespace LIBC_NAMESPACE_DECL {

// Struct to store -log*(r) for 4 range reduction steps.
struct LogRR {};

// Perform logarithm range reduction steps 2-4.
// Inputs from the first step of range reduction:
//   m_x : the reduced argument after the first step of range reduction
//         satisfying  -2^-8 <= m_x < 2^-7  and  ulp(m_x) >= 2^-60.
//   idx1: index of the -log(r1) table from the first step.
// Outputs of the extra range reduction steps:
//   sum: adding -log(r1) - log(r2) - log(r3) - log(r4) to the resulted sum.
//   return value: the reduced argument v satisfying:
//                 -0x1.0002143p-29 <= v < 0x1p-29,  and  ulp(v) >= 2^(-125).
LIBC_INLINE fputil::DyadicFloat<128>
log_range_reduction(double m_x, const LogRR &log_table,
                    fputil::DyadicFloat<128> &sum) {}

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_MATH_GENERIC_LOG_RANGE_REDUCTION_H