1 //===-- Common constants for math functions ---------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_SRC_MATH_GENERIC_COMMON_CONSTANTS_H
10 #define LLVM_LIBC_SRC_MATH_GENERIC_COMMON_CONSTANTS_H
12 namespace __llvm_libc
{
14 // Lookup table for (1/f) where f = 1 + n*2^(-7), n = 0..127.
15 extern const double ONE_OVER_F
[128];
17 // Lookup table for log(f) = log(1 + n*2^(-7)) where n = 0..127.
18 extern const double LOG_F
[128];
20 // Lookup table for range reduction constants r for logarithms.
21 extern const float R
[128];
23 // Lookup table for range reduction constants r for logarithms.
24 extern const double RD
[128];
26 // Lookup table for -log(r)
27 extern const double LOG_R
[128];
29 // Lookup table for exp(m) with m = -104, ..., 89.
30 // -104 = floor(log(single precision's min denormal))
31 // 89 = ceil(log(single precision's max normal))
32 // Table is generated with Sollya as follow:
33 // > display = hexadecimal;
34 // > for i from -104 to 89 do { D(exp(i)); };
35 extern const double EXP_M1
[195];
37 // Lookup table for exp(m * 2^(-7)) with m = 0, ..., 127.
38 // Table is generated with Sollya as follow:
39 // > display = hexadecimal;
40 // > for i from 0 to 127 do { D(exp(i / 128)); };
41 extern const double EXP_M2
[128];
43 } // namespace __llvm_libc
45 #endif // LLVM_LIBC_SRC_MATH_GENERIC_COMMON_CONSTANTS_H