summaryrefslogtreecommitdiff
path: root/libc/utils
diff options
context:
space:
mode:
authorTue Ly <lntue.h@gmail.com>2023-01-27 23:06:11 -0500
committerTue Ly <lntue@google.com>2023-02-01 11:35:15 -0500
commit9b30f6b6d76fcd4887c692ab6c182975f3390dca (patch)
tree5f0fa4f867ae996846a7db242e048e82f62ce32d /libc/utils
parent47fbb247dab24e10c5b582e47c5a038e34d75473 (diff)
downloadllvm-9b30f6b6d76fcd4887c692ab6c182975f3390dca.tar.gz
[libc][math] Implement acoshf function correctly rounded to all rounding modes.
Implement acoshf function correctly rounded to all rounding modes. Reviewed By: zimmermann6 Differential Revision: https://reviews.llvm.org/D142781
Diffstat (limited to 'libc/utils')
-rw-r--r--libc/utils/MPFRWrapper/MPFRUtils.cpp9
-rw-r--r--libc/utils/MPFRWrapper/MPFRUtils.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index f1f0fd9a66e0..2b44c2493f02 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -190,6 +190,12 @@ public:
return result;
}
+ MPFRNumber acosh() const {
+ MPFRNumber result(*this);
+ mpfr_acosh(result.value, value, mpfr_rounding);
+ return result;
+ }
+
MPFRNumber asin() const {
MPFRNumber result(*this);
mpfr_asin(result.value, value, mpfr_rounding);
@@ -201,6 +207,7 @@ public:
mpfr_asinh(result.value, value, mpfr_rounding);
return result;
}
+
MPFRNumber atan() const {
MPFRNumber result(*this);
mpfr_atan(result.value, value, mpfr_rounding);
@@ -545,6 +552,8 @@ unary_operation(Operation op, InputType input, unsigned int precision,
return mpfrInput.abs();
case Operation::Acos:
return mpfrInput.acos();
+ case Operation::Acosh:
+ return mpfrInput.acosh();
case Operation::Asin:
return mpfrInput.asin();
case Operation::Asinh:
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.h b/libc/utils/MPFRWrapper/MPFRUtils.h
index 35e1606b1cce..dbb9b410d1b1 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.h
+++ b/libc/utils/MPFRWrapper/MPFRUtils.h
@@ -26,6 +26,7 @@ enum class Operation : int {
BeginUnaryOperationsSingleOutput,
Abs,
Acos,
+ Acosh,
Asin,
Asinh,
Atan,