Average Error: 58.0 → 0.7
Time: 3.4s
Precision: binary64
\[\frac{e^{x} - e^{-x}}{2}\]
\[\frac{\left(x + x\right) + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)}{2}\]
\frac{e^{x} - e^{-x}}{2}
\frac{\left(x + x\right) + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)}{2}
double code(double x) {
	return ((double) (((double) (((double) exp(x)) - ((double) exp(((double) -(x)))))) / 2.0));
}
double code(double x) {
	return ((double) (((double) (((double) (x + x)) + ((double) (((double) (0.3333333333333333 * ((double) pow(x, 3.0)))) + ((double) (0.016666666666666666 * ((double) pow(x, 5.0)))))))) / 2.0));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.0

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

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

    \[\leadsto \frac{\color{blue}{x + \left(x + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)\right)}}{2}\]
  4. Using strategy rm
  5. Applied associate-+r+0.7

    \[\leadsto \frac{\color{blue}{\left(x + x\right) + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)}}{2}\]
  6. Final simplification0.7

    \[\leadsto \frac{\left(x + x\right) + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)}{2}\]

Reproduce

herbie shell --seed 2020184 
(FPCore (x)
  :name "Hyperbolic sine"
  :precision binary64
  (/ (- (exp x) (exp (- x))) 2.0))