Average Error: 57.8 → 0.8
Time: 19.0s
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 r2354477 = x;
        double r2354478 = exp(r2354477);
        double r2354479 = -r2354477;
        double r2354480 = exp(r2354479);
        double r2354481 = r2354478 - r2354480;
        double r2354482 = 2.0;
        double r2354483 = r2354481 / r2354482;
        return r2354483;
}

double f(double x) {
        double r2354484 = x;
        double r2354485 = 0.3333333333333333;
        double r2354486 = r2354484 * r2354484;
        double r2354487 = 2.0;
        double r2354488 = fma(r2354485, r2354486, r2354487);
        double r2354489 = 0.016666666666666666;
        double r2354490 = 5.0;
        double r2354491 = pow(r2354484, r2354490);
        double r2354492 = r2354489 * r2354491;
        double r2354493 = fma(r2354484, r2354488, r2354492);
        double r2354494 = r2354493 / r2354487;
        return r2354494;
}

Error

Bits error versus x

Derivation

  1. Initial program 57.8

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

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

    \[\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.8

    \[\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 2019143 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic sine"
  (/ (- (exp x) (exp (- x))) 2))