Average Error: 58.0 → 0.7
Time: 17.4s
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 r2618353 = x;
        double r2618354 = exp(r2618353);
        double r2618355 = -r2618353;
        double r2618356 = exp(r2618355);
        double r2618357 = r2618354 - r2618356;
        double r2618358 = 2.0;
        double r2618359 = r2618357 / r2618358;
        return r2618359;
}

double f(double x) {
        double r2618360 = x;
        double r2618361 = 0.3333333333333333;
        double r2618362 = r2618360 * r2618360;
        double r2618363 = 2.0;
        double r2618364 = fma(r2618361, r2618362, r2618363);
        double r2618365 = 0.016666666666666666;
        double r2618366 = 5.0;
        double r2618367 = pow(r2618360, r2618366);
        double r2618368 = r2618365 * r2618367;
        double r2618369 = fma(r2618360, r2618364, r2618368);
        double r2618370 = r2618369 / r2618363;
        return r2618370;
}

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}, x \cdot x, 2\right), {x}^{5} \cdot \frac{1}{60}\right)}}{2}\]
  4. Final simplification0.7

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