Skip to content

[libc][NFC] Enforce internal linkage for exp* support functions. #76250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libc/src/math/generic/exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ constexpr double MLOG_2_EXP2_M12_MID = 0x1.718432a1b0e26p-47;
constexpr double MLOG_2_EXP2_M12_MID_30 = 0x1.718432ap-47;
constexpr double MLOG_2_EXP2_M12_LO = 0x1.b0e2633fe0685p-79;

namespace {

// Polynomial approximations with double precision:
// Return expm1(dx) / x ~ 1 + dx / 2 + dx^2 / 6 + dx^3 / 24.
// For |dx| < 2^-13 + 2^-30:
Expand Down Expand Up @@ -218,6 +220,8 @@ double set_exceptional(double x) {
return x + static_cast<double>(FPBits::inf());
}

} // namespace

LLVM_LIBC_FUNCTION(double, exp, (double x)) {
using FPBits = typename fputil::FPBits<double>;
using FloatProp = typename fputil::FloatProperties<double>;
Expand Down
4 changes: 4 additions & 0 deletions libc/src/math/generic/exp10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ constexpr double ERR_D = 0x1.8p-63;
// Errors when using double-double precision.
constexpr double ERR_DD = 0x1.8p-99;

namespace {

// Polynomial approximations with double precision. Generated by Sollya with:
// > P = fpminimax((10^x - 1)/x, 3, [|D...|], [-2^-14, 2^-14]);
// > P;
Expand Down Expand Up @@ -268,6 +270,8 @@ double set_exceptional(double x) {
return x + static_cast<double>(FPBits::inf());
}

} // namespace

LLVM_LIBC_FUNCTION(double, exp10, (double x)) {
using FPBits = typename fputil::FPBits<double>;
using FloatProp = typename fputil::FloatProperties<double>;
Expand Down
4 changes: 4 additions & 0 deletions libc/src/math/generic/exp2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ constexpr double ERR_D = 0x1.8p-63;
// Errors when using double-double precision.
constexpr double ERR_DD = 0x1.0p-100;

namespace {

// Polynomial approximations with double precision. Generated by Sollya with:
// > P = fpminimax((2^x - 1)/x, 3, [|D...|], [-2^-13 - 2^-30, 2^-13 + 2^-30]);
// > P;
Expand Down Expand Up @@ -243,6 +245,8 @@ double set_exceptional(double x) {
return x + static_cast<double>(FPBits::inf());
}

} // namespace

LLVM_LIBC_FUNCTION(double, exp2, (double x)) {
using FPBits = typename fputil::FPBits<double>;
using FloatProp = typename fputil::FloatProperties<double>;
Expand Down
4 changes: 4 additions & 0 deletions libc/src/math/generic/expm1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ constexpr double MLOG_2_EXP2_M12_MID = 0x1.718432a1b0e26p-47;
constexpr double MLOG_2_EXP2_M12_MID_30 = 0x1.718432ap-47;
constexpr double MLOG_2_EXP2_M12_LO = 0x1.b0e2633fe0685p-79;

namespace {

// Polynomial approximations with double precision:
// Return expm1(dx) / x ~ 1 + dx / 2 + dx^2 / 6 + dx^3 / 24.
// For |dx| < 2^-13 + 2^-30:
Expand Down Expand Up @@ -269,6 +271,8 @@ double set_exceptional(double x) {
return x + static_cast<double>(FPBits::inf());
}

} // namespace

LLVM_LIBC_FUNCTION(double, expm1, (double x)) {
using FPBits = typename fputil::FPBits<double>;
using FloatProp = typename fputil::FloatProperties<double>;
Expand Down