Skip to content

[libc] Simplify the version guard for mpfr. #146354

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 6 additions & 14 deletions libc/utils/MPFRWrapper/MPCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ MPFRNumber MPFRNumber::acosh() const {
MPFRNumber MPFRNumber::acospi() const {
MPFRNumber result(*this);

#if MPFR_VERSION_MAJOR > 4 || \
(MPFR_VERSION_MAJOR == 4 && MPFR_VERSION_MINOR >= 2)
#if MPFR_VERSION >= MPFR_VERSION_NUM(4, 2, 0)
mpfr_acospi(result.value, value, mpfr_rounding);
return result;
#else
Expand Down Expand Up @@ -150,8 +149,7 @@ MPFRNumber MPFRNumber::cosh() const {
MPFRNumber MPFRNumber::cospi() const {
MPFRNumber result(*this);

#if MPFR_VERSION_MAJOR > 4 || \
(MPFR_VERSION_MAJOR == 4 && MPFR_VERSION_MINOR >= 2)
#if MPFR_VERSION >= MPFR_VERSION_NUM(4, 2, 0)
mpfr_cospi(result.value, value, mpfr_rounding);
return result;
#else
Expand Down Expand Up @@ -195,8 +193,7 @@ MPFRNumber MPFRNumber::exp2() const {

MPFRNumber MPFRNumber::exp2m1() const {
// TODO: Only use mpfr_exp2m1 once CI and buildbots get MPFR >= 4.2.0.
#if MPFR_VERSION_MAJOR > 4 || \
(MPFR_VERSION_MAJOR == 4 && MPFR_VERSION_MINOR >= 2)
#if MPFR_VERSION >= MPFR_VERSION_NUM(4, 2, 0)
MPFRNumber result(*this);
mpfr_exp2m1(result.value, value, mpfr_rounding);
return result;
Expand Down Expand Up @@ -231,8 +228,7 @@ MPFRNumber MPFRNumber::exp10() const {

MPFRNumber MPFRNumber::exp10m1() const {
// TODO: Only use mpfr_exp10m1 once CI and buildbots get MPFR >= 4.2.0.
#if MPFR_VERSION_MAJOR > 4 || \
(MPFR_VERSION_MAJOR == 4 && MPFR_VERSION_MINOR >= 2)
#if MPFR_VERSION >= MPFR_VERSION_NUM(4, 2, 0)
MPFRNumber result(*this);
mpfr_exp10m1(result.value, value, mpfr_rounding);
return result;
Expand Down Expand Up @@ -402,9 +398,7 @@ MPFRNumber MPFRNumber::sin() const {
MPFRNumber MPFRNumber::sinpi() const {
MPFRNumber result(*this);

#if MPFR_VERSION_MAJOR > 4 || \
(MPFR_VERSION_MAJOR == 4 && MPFR_VERSION_MINOR >= 2)

#if MPFR_VERSION >= MPFR_VERSION_NUM(4, 2, 0)
mpfr_sinpi(result.value, value, mpfr_rounding);
return result;
#else
Expand Down Expand Up @@ -463,9 +457,7 @@ MPFRNumber MPFRNumber::tanh() const {
MPFRNumber MPFRNumber::tanpi() const {
MPFRNumber result(*this);

#if MPFR_VERSION_MAJOR > 4 || \
(MPFR_VERSION_MAJOR == 4 && MPFR_VERSION_MINOR >= 2)

#if MPFR_VERSION >= MPFR_VERSION_NUM(4, 2, 0)
mpfr_tanpi(result.value, value, mpfr_rounding);
return result;
#else
Expand Down
Loading