Average Error: 29.2 → 0.6
Time: 7.2s
Precision: binary64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[x \cdot x + \left(0.002777777777777778 \cdot {x}^{6} + 0.08333333333333333 \cdot {x}^{4}\right)\]
\left(e^{x} - 2\right) + e^{-x}
x \cdot x + \left(0.002777777777777778 \cdot {x}^{6} + 0.08333333333333333 \cdot {x}^{4}\right)
double code(double x) {
	return ((double) (((double) (((double) exp(x)) - 2.0)) + ((double) exp(((double) -(x))))));
}
double code(double x) {
	return ((double) (((double) (x * x)) + ((double) (((double) (0.002777777777777778 * ((double) pow(x, 6.0)))) + ((double) (0.08333333333333333 * ((double) pow(x, 4.0))))))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.2
Target0.0
Herbie0.6
\[4 \cdot {\left(\sinh \left(\frac{x}{2}\right)\right)}^{2}\]

Derivation

  1. Initial program 29.2

    \[\left(e^{x} - 2\right) + e^{-x}\]
  2. Simplified29.2

    \[\leadsto \color{blue}{e^{x} + \left(e^{-x} - 2\right)}\]
  3. Taylor expanded around 0 0.6

    \[\leadsto \color{blue}{{x}^{2} + \left(0.002777777777777778 \cdot {x}^{6} + 0.08333333333333333 \cdot {x}^{4}\right)}\]
  4. Simplified0.6

    \[\leadsto \color{blue}{x \cdot x + \left(0.002777777777777778 \cdot {x}^{6} + 0.08333333333333333 \cdot {x}^{4}\right)}\]
  5. Final simplification0.6

    \[\leadsto x \cdot x + \left(0.002777777777777778 \cdot {x}^{6} + 0.08333333333333333 \cdot {x}^{4}\right)\]

Reproduce

herbie shell --seed 2020196 
(FPCore (x)
  :name "exp2 (problem 3.3.7)"
  :precision binary64
  :herbie-expected 1.5

  :herbie-target
  (* 4.0 (pow (sinh (/ x 2.0)) 2.0))

  (+ (- (exp x) 2.0) (exp (- x))))