Average Error: 29.7 → 0.7
Time: 5.4s
Precision: binary64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\left(x \cdot x + 0.002777777777777778 \cdot {x}^{6}\right) + 0.08333333333333333 \cdot {x}^{4}\]
\left(e^{x} - 2\right) + e^{-x}
\left(x \cdot x + 0.002777777777777778 \cdot {x}^{6}\right) + 0.08333333333333333 \cdot {x}^{4}
(FPCore (x) :precision binary64 (+ (- (exp x) 2.0) (exp (- x))))
(FPCore (x)
 :precision binary64
 (+
  (+ (* x x) (* 0.002777777777777778 (pow x 6.0)))
  (* 0.08333333333333333 (pow x 4.0))))
double code(double x) {
	return (exp(x) - 2.0) + exp(-x);
}
double code(double x) {
	return ((x * x) + (0.002777777777777778 * pow(x, 6.0))) + (0.08333333333333333 * 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.7
Target0.0
Herbie0.7
\[4 \cdot {\sinh \left(\frac{x}{2}\right)}^{2}\]

Derivation

  1. Initial program 29.7

    \[\left(e^{x} - 2\right) + e^{-x}\]
  2. Taylor expanded around 0 0.7

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

    \[\leadsto \color{blue}{x \cdot x + \left(0.002777777777777778 \cdot {x}^{6} + 0.08333333333333333 \cdot {x}^{4}\right)}\]
  4. Using strategy rm
  5. Applied associate-+r+_binary640.7

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

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

Reproduce

herbie shell --seed 2020253 
(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))))