Average Error: 57.8 → 0.7
Time: 11.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 r2432996 = x;
        double r2432997 = exp(r2432996);
        double r2432998 = -r2432996;
        double r2432999 = exp(r2432998);
        double r2433000 = r2432997 - r2432999;
        double r2433001 = 2.0;
        double r2433002 = r2433000 / r2433001;
        return r2433002;
}

double f(double x) {
        double r2433003 = x;
        double r2433004 = 0.3333333333333333;
        double r2433005 = r2433003 * r2433003;
        double r2433006 = 2.0;
        double r2433007 = fma(r2433004, r2433005, r2433006);
        double r2433008 = 0.016666666666666666;
        double r2433009 = 5.0;
        double r2433010 = pow(r2433003, r2433009);
        double r2433011 = r2433008 * r2433010;
        double r2433012 = fma(r2433003, r2433007, r2433011);
        double r2433013 = r2433012 / r2433006;
        return r2433013;
}

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