[libc-commits] [libc] [libc] Add sinpif16 function (PR #110994)
via libc-commits
libc-commits at lists.llvm.org
Fri Oct 11 13:01:31 PDT 2024
================
@@ -492,7 +492,19 @@ class MPFRNumber {
MPFRNumber value_pi(0.0, 1280);
mpfr_const_pi(value_pi.value, MPFR_RNDN);
mpfr_mul(value_pi.value, value_pi.value, value, MPFR_RNDN);
- mpfr_sin(result.value, value_pi.value, mpfr_rounding);
+
+ int ret = mpfr_integer_p(value);
+ MPFRNumber value_mul_two(*this);
+ mpfr_mul_si(value_mul_two.value, value, 2, MPFR_RNDN);
+ if (mpfr_integer_p(value_mul_two.value) != 0) {
+ if (ret != 0) {
+ mpfr_set_si(result.value, 0, mpfr_rounding);
+ } else {
+ mpfr_sin(result.value, value_pi.value, MPFR_RNDN);
+ }
----------------
overmighty wrote:
Nits:
```suggestion
MPFRNumber value_mul_two(*this);
mpfr_mul_si(value_mul_two.value, value, 2, MPFR_RNDN);
if (mpfr_integer_p(value_mul_two.value)) {
if (mpfr_integer_p(value))
mpfr_set_si(result.value, 0, mpfr_rounding);
else
mpfr_sin(result.value, value_pi.value, MPFR_RNDN);
```
https://github.com/llvm/llvm-project/pull/110994
More information about the libc-commits
mailing list