[libc-commits] [libc] [libc][math][c23] Implement C23 math function atanpif16 (PR #150400)
via libc-commits
libc-commits at lists.llvm.org
Sun Aug 31 07:29:48 PDT 2025
================
@@ -123,6 +123,21 @@ MPFRNumber MPFRNumber::atanh() const {
return result;
}
+MPFRNumber MPFRNumber::atanpi() const {
+ MPFRNumber result(*this);
+#if MPFR_VERSION >= MPFR_VERSION_NUM(4, 2, 0)
+ mpfr_atanpi(result.value, value, mpfr_rounding);
+ return result;
+#else
+ MPFRNumber value_atan(0.0, 1280);
+ mpfr_atan(value_atan.value, value, MPFR_RNDN);
+ MPFRNumber value_pi(0.0, 1280);
----------------
overmighty wrote:
`mpfr_precision * 3` is enough here. Reduces the exhaustive test run time from 2 * ~3s to 2 * ~0.4s on my machine (Intel Core i7-13700H).
```suggestion
MPFRNumber value_atan(0.0, mpfr_precision * 3);
mpfr_atan(value_atan.value, value, MPFR_RNDN);
MPFRNumber value_pi(0.0, mpfr_precision * 3);
```
https://github.com/llvm/llvm-project/pull/150400
More information about the libc-commits
mailing list