Average Error: 58.0 → 0.6
Time: 4.8s
Precision: 64
\[\frac{e^{x} - e^{-x}}{2}\]
\[\frac{\left(\frac{1}{3} \cdot {x}^{3} + \frac{1}{60} \cdot {x}^{5}\right) + 2 \cdot x}{2}\]
\frac{e^{x} - e^{-x}}{2}
\frac{\left(\frac{1}{3} \cdot {x}^{3} + \frac{1}{60} \cdot {x}^{5}\right) + 2 \cdot x}{2}
double code(double x) {
	return ((exp(x) - exp(-x)) / 2.0);
}
double code(double x) {
	return ((((0.3333333333333333 * pow(x, 3.0)) + (0.016666666666666666 * pow(x, 5.0))) + (2.0 * x)) / 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.6

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

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

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

Reproduce

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