Skip to content

Commit b2e47da

Browse files
committed
Addressed some potential style comments:
- Changed order in MPCommon.h and .cpp Added workaround for older MPFR version - Support for acospi Fixed some nit in acospif16.cpp for the comments to look nice
1 parent d820ed5 commit b2e47da

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

libc/src/math/generic/acospif16.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- Half-precision acospi function ------------------------------===//
1+
//===-- Half-precision acospi function ------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

libc/utils/MPFRWrapper/MPCommon.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,26 @@ MPFRNumber MPFRNumber::acos() const {
6464
return result;
6565
}
6666

67-
MPFRNumber MPFRNumber::acospi() const {
67+
MPFRNumber MPFRNumber::acosh() const {
6868
MPFRNumber result(*this);
69-
mpfr_acospi(result.value, value, mpfr_rounding);
69+
mpfr_acosh(result.value, value, mpfr_rounding);
7070
return result;
7171
}
7272

73-
MPFRNumber MPFRNumber::acosh() const {
73+
MPFRNumber MPFRNumber::acospi() const {
7474
MPFRNumber result(*this);
75-
mpfr_acosh(result.value, value, mpfr_rounding);
75+
76+
#if MPFR_VERSION_MAJOR > 4 || \
77+
(MPFR_VERSION_MAJOR == 4 && MPFR_VERSION_MINOR >= 2)
78+
mpfr_acospi(result.value, value, mpfr_rounding);
79+
return result;
80+
#else
81+
mpfr_acos(result.value, value, mpfr_rounding);
82+
MPFRNumber value_pi(0.0, 1280);
83+
mpfr_const_pi(value_pi.value, MPFR_RNDN);
84+
mpfr_div(result.value, result.value, value_pi.value, mpfr_rounding);
7685
return result;
86+
#endif
7787
}
7888

7989
MPFRNumber MPFRNumber::add(const MPFRNumber &b) const {

libc/utils/MPFRWrapper/MPCommon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ class MPFRNumber {
180180
bool is_nan() const;
181181
MPFRNumber abs() const;
182182
MPFRNumber acos() const;
183-
MPFRNumber acospi() const;
184183
MPFRNumber acosh() const;
184+
MPFRNumber acospi() const;
185185
MPFRNumber add(const MPFRNumber &b) const;
186186
MPFRNumber asin() const;
187187
MPFRNumber asinh() const;

0 commit comments

Comments
 (0)