Average Error: 57.8 → 0.7
Time: 12.5s
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 r2306219 = x;
        double r2306220 = exp(r2306219);
        double r2306221 = -r2306219;
        double r2306222 = exp(r2306221);
        double r2306223 = r2306220 - r2306222;
        double r2306224 = 2.0;
        double r2306225 = r2306223 / r2306224;
        return r2306225;
}

double f(double x) {
        double r2306226 = x;
        double r2306227 = 0.3333333333333333;
        double r2306228 = r2306226 * r2306226;
        double r2306229 = 2.0;
        double r2306230 = fma(r2306227, r2306228, r2306229);
        double r2306231 = 0.016666666666666666;
        double r2306232 = 5.0;
        double r2306233 = pow(r2306226, r2306232);
        double r2306234 = r2306231 * r2306233;
        double r2306235 = fma(r2306226, r2306230, r2306234);
        double r2306236 = r2306235 / r2306229;
        return r2306236;
}

Error

Bits error versus x

Derivation

  1. Initial program 57.8

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