llvm/libc/src/__support/detailed_powers_of_ten.h

//===-- detailed powers of ten ----------------------------------*- C++ -*-===//
//
// 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___SUPPORT_DETAILED_POWERS_OF_TEN_H
#define LLVM_LIBC_SRC___SUPPORT_DETAILED_POWERS_OF_TEN_H

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

#include <stdint.h>

namespace LIBC_NAMESPACE_DECL {
namespace internal {

// TODO(michaelrj): write a script that will generate this table.

// This table was generated by
// https://github.com/google/wuffs/blob/788479dd64f35cb6b4e998a851acb06ee962435b/script/print-mpb-powers-of-10.go
// and contains the 128 bit mantissa approximations of the powers of 10 from
// -348 to 347. The exponents are implied by a linear expression with slope
// 217706.0/65536.0 ≈ log(10)/log(2). This is used by the Eisel-Lemire algorithm
// in str_to_float.h.

constexpr int32_t DETAILED_POWERS_OF_TEN_MIN_EXP_10 =;
constexpr int32_t DETAILED_POWERS_OF_TEN_MAX_EXP_10 =;

// This rescales the base 10 exponent by a factor of log(10)/log(2).
LIBC_INLINE int32_t exp10_to_exp2(int32_t exp10) {}

static constexpr uint64_t DETAILED_POWERS_OF_TEN[696][2] =;

} // namespace internal
} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC___SUPPORT_DETAILED_POWERS_OF_TEN_H