[libc-commits] [PATCH] D129278: [libc][math] Added sinhf function.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jul 19 21:36:30 PDT 2022


lntue added inline comments.


================
Comment at: libc/src/math/generic/sinhf.cpp:59
+    double x2 = xdbl * xdbl;
+    // Sollya: fpminimax(sinh(x),[|3,5,7|],[|D...|],[-1/16-1/64;1/16+1/64],x);
+    double pe = fputil::polyeval(x2, 0.0, 0x1.5555555556583p-3,
----------------
It should either be:
```
// Sollya: fpminimax(sinh(x),[|1, 3,5,7|],[|D...|],[-1/16-1/64;1/16+1/64],x);
```
or
```
// Sollya: fpminimax(sinh(x) - x,[|3,5,7|],[|D...|],[-1/16-1/64;1/16+1/64],x);
```



================
Comment at: libc/src/math/generic/sinhf.cpp:60-62
+    double pe = fputil::polyeval(x2, 0.0, 0x1.5555555556583p-3,
+                                 0x1.111110d239f1fp-7, 0x1.a02b5a284013cp-13);
+    return fputil::multiply_add(xdbl, pe, xdbl);
----------------
Will this change the accuracy / throughput / latency for this range of inputs?
```
double x3 = x2 * xdbl;
double pe = fputil::polyeval(x2, 0x1.5555555556583p-3, 0x1.111110d239f1fp-7, 0x1.a02b5a284013cp-13);
return fputil::multiply_add(x3, pe, xdbl);
```


================
Comment at: libc/src/math/generic/sinhf.cpp:67-69
+  double ep = fputil::multiply_add(ep_p.mult_exp, ep_p.r, ep_p.mult_exp - 1.0) -
+              fputil::multiply_add(ep_m.mult_exp, ep_m.r, ep_m.mult_exp - 1.0);
+  return 0.5 * ep;
----------------
Add comments about your expanded formula / computations:
```
  exp(x) = ep_p.mult_exp * (ep_p.r + 1)
  exp(-x) = ep_m.mult_exp * (ep_m.r + 1)
  sinh(x) = (exp(x) - exp(-x)) / 2 = ...
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129278/new/

https://reviews.llvm.org/D129278



More information about the libc-commits mailing list