Average Error: 58.0 → 0.6
Time: 19.6s
Precision: 64
\[\frac{e^{x} - e^{-x}}{2}\]
\[\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{3}, x \cdot x, 2\right), \frac{1}{60} \cdot {x}^{5}\right)}{2}\]
\frac{e^{x} - e^{-x}}{2}
\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{3}, x \cdot x, 2\right), \frac{1}{60} \cdot {x}^{5}\right)}{2}
double f(double x) {
        double r2825563 = x;
        double r2825564 = exp(r2825563);
        double r2825565 = -r2825563;
        double r2825566 = exp(r2825565);
        double r2825567 = r2825564 - r2825566;
        double r2825568 = 2.0;
        double r2825569 = r2825567 / r2825568;
        return r2825569;
}

double f(double x) {
        double r2825570 = x;
        double r2825571 = 0.3333333333333333;
        double r2825572 = r2825570 * r2825570;
        double r2825573 = 2.0;
        double r2825574 = fma(r2825571, r2825572, r2825573);
        double r2825575 = 0.016666666666666666;
        double r2825576 = 5.0;
        double r2825577 = pow(r2825570, r2825576);
        double r2825578 = r2825575 * r2825577;
        double r2825579 = fma(r2825570, r2825574, r2825578);
        double r2825580 = r2825579 / r2825573;
        return r2825580;
}

Error

Bits error versus x

Derivation

  1. Initial program 58.0

    \[\frac{e^{x} - e^{-x}}{2}\]
  2. Taylor expanded around 0 0.6

    \[\leadsto \frac{\color{blue}{2 \cdot x + \left(\frac{1}{3} \cdot {x}^{3} + \frac{1}{60} \cdot {x}^{5}\right)}}{2}\]
  3. Simplified0.6

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{3}, x \cdot x, 2\right), {x}^{5} \cdot \frac{1}{60}\right)}}{2}\]
  4. Final simplification0.6

    \[\leadsto \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{3}, x \cdot x, 2\right), \frac{1}{60} \cdot {x}^{5}\right)}{2}\]

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic sine"
  (/ (- (exp x) (exp (- x))) 2))