Average Error: 58.0 → 0.7
Time: 14.3s
Precision: 64
\[\frac{e^{x} - e^{-x}}{2}\]
\[\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot \frac{1}{3}, 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(x \cdot \frac{1}{3}, x, 2\right), \frac{1}{60} \cdot {x}^{5}\right)}{2}
double f(double x) {
        double r890620 = x;
        double r890621 = exp(r890620);
        double r890622 = -r890620;
        double r890623 = exp(r890622);
        double r890624 = r890621 - r890623;
        double r890625 = 2.0;
        double r890626 = r890624 / r890625;
        return r890626;
}

double f(double x) {
        double r890627 = x;
        double r890628 = 0.3333333333333333;
        double r890629 = r890627 * r890628;
        double r890630 = 2.0;
        double r890631 = fma(r890629, r890627, r890630);
        double r890632 = 0.016666666666666666;
        double r890633 = 5.0;
        double r890634 = pow(r890627, r890633);
        double r890635 = r890632 * r890634;
        double r890636 = fma(r890627, r890631, r890635);
        double r890637 = r890636 / r890630;
        return r890637;
}

Error

Bits error versus x

Derivation

  1. Initial program 58.0

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

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

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

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

Reproduce

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