Skip to content

Commit 8091e48

Browse files
committed
fix: handle asinpi for mpfr < 4.2.0
1 parent d8a2bbe commit 8091e48

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libc/utils/MPFRWrapper/MPCommon.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,17 @@ MPFRNumber MPFRNumber::asinh() const {
107107

108108
MPFRNumber MPFRNumber::asinpi() const {
109109
MPFRNumber result(*this);
110+
#if 0 && (MPFR_VERSION >= MPFR_VERSION_NUM(4, 2, 0))
110111
mpfr_asinpi(result.value, value, mpfr_rounding);
111112
return result;
113+
#else
114+
MPFRNumber value_asin(0.0, 1280);
115+
mpfr_asin(value_asin.value, value, MPFR_RNDN);
116+
MPFRNumber value_pi(0.0, 1280);
117+
mpfr_const_pi(value_pi.value, MPFR_RNDN);
118+
mpfr_div(result.value, value_asin.value, value_pi.value, mpfr_rounding);
119+
return result;
120+
#endif
112121
}
113122

114123
MPFRNumber MPFRNumber::atan() const {

0 commit comments

Comments
 (0)