Average Error: 58.0 → 0.6
Time: 19.2s
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 r2848168 = x;
        double r2848169 = exp(r2848168);
        double r2848170 = -r2848168;
        double r2848171 = exp(r2848170);
        double r2848172 = r2848169 - r2848171;
        double r2848173 = 2.0;
        double r2848174 = r2848172 / r2848173;
        return r2848174;
}

double f(double x) {
        double r2848175 = x;
        double r2848176 = 0.3333333333333333;
        double r2848177 = r2848175 * r2848175;
        double r2848178 = 2.0;
        double r2848179 = fma(r2848176, r2848177, r2848178);
        double r2848180 = 0.016666666666666666;
        double r2848181 = 5.0;
        double r2848182 = pow(r2848175, r2848181);
        double r2848183 = r2848180 * r2848182;
        double r2848184 = fma(r2848175, r2848179, r2848183);
        double r2848185 = r2848184 / r2848178;
        return r2848185;
}

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))