1 //===-- Common constants for math functions ---------------------*- C++ -*-===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_SRC_MATH_GENERIC_COMMON_CONSTANTS_H 10 #define LLVM_LIBC_SRC_MATH_GENERIC_COMMON_CONSTANTS_H 11 12 namespace __llvm_libc { 13 14 // Lookup table for (1/f) where f = 1 + n*2^(-7), n = 0..127. 15 extern const double ONE_OVER_F[128]; 16 17 // Lookup table for log(f) = log(1 + n*2^(-7)) where n = 0..127. 18 extern const double LOG_F[128]; 19 20 // Lookup table for exp(m) with m = -104, ..., 89. 21 // -104 = floor(log(single precision's min denormal)) 22 // 89 = ceil(log(single precision's max normal)) 23 // Table is generated with Sollya as follow: 24 // > display = hexadecimal; 25 // > for i from -104 to 89 do { D(exp(i)); }; 26 extern const double EXP_M1[195]; 27 28 // Lookup table for exp(m * 2^(-7)) with m = 0, ..., 127. 29 // Table is generated with Sollya as follow: 30 // > display = hexadecimal; 31 // > for i from 0 to 127 do { D(exp(i / 128)); }; 32 extern const double EXP_M2[128]; 33 34 } // namespace __llvm_libc 35 36 #endif // LLVM_LIBC_SRC_MATH_GENERIC_COMMON_CONSTANTS_H 37