Average Error: 29.4 → 0.5
Time: 5.1s
Precision: binary64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\sqrt{x \cdot x + \left(0.08333333333333333 \cdot {x}^{4} + 0.002777777777777778 \cdot {x}^{6}\right)} \cdot \sqrt{x \cdot x + \left(0.08333333333333333 \cdot {x}^{4} + 0.002777777777777778 \cdot {x}^{6}\right)} + 4.96031746031746 \cdot 10^{-05} \cdot {x}^{8}\]
\left(e^{x} - 2\right) + e^{-x}
\sqrt{x \cdot x + \left(0.08333333333333333 \cdot {x}^{4} + 0.002777777777777778 \cdot {x}^{6}\right)} \cdot \sqrt{x \cdot x + \left(0.08333333333333333 \cdot {x}^{4} + 0.002777777777777778 \cdot {x}^{6}\right)} + 4.96031746031746 \cdot 10^{-05} \cdot {x}^{8}
(FPCore (x) :precision binary64 (+ (- (exp x) 2.0) (exp (- x))))
(FPCore (x)
 :precision binary64
 (+
  (*
   (sqrt
    (+
     (* x x)
     (+
      (* 0.08333333333333333 (pow x 4.0))
      (* 0.002777777777777778 (pow x 6.0)))))
   (sqrt
    (+
     (* x x)
     (+
      (* 0.08333333333333333 (pow x 4.0))
      (* 0.002777777777777778 (pow x 6.0))))))
  (* 4.96031746031746e-05 (pow x 8.0))))
double code(double x) {
	return (exp(x) - 2.0) + exp(-x);
}
double code(double x) {
	return (sqrt((x * x) + ((0.08333333333333333 * pow(x, 4.0)) + (0.002777777777777778 * pow(x, 6.0)))) * sqrt((x * x) + ((0.08333333333333333 * pow(x, 4.0)) + (0.002777777777777778 * pow(x, 6.0))))) + (4.96031746031746e-05 * pow(x, 8.0));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.4

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

    \[\leadsto \color{blue}{4.96031746031746 \cdot 10^{-05} \cdot {x}^{8} + \left({x}^{2} + \left(0.002777777777777778 \cdot {x}^{6} + 0.08333333333333333 \cdot {x}^{4}\right)\right)}\]
  3. Simplified0.5

    \[\leadsto \color{blue}{\left(x \cdot x + \left(0.08333333333333333 \cdot {x}^{4} + 0.002777777777777778 \cdot {x}^{6}\right)\right) + 4.96031746031746 \cdot 10^{-05} \cdot {x}^{8}}\]
  4. Using strategy rm
  5. Applied add-sqr-sqrt_binary640.5

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

    \[\leadsto \sqrt{x \cdot x + \left(0.08333333333333333 \cdot {x}^{4} + 0.002777777777777778 \cdot {x}^{6}\right)} \cdot \sqrt{x \cdot x + \left(0.08333333333333333 \cdot {x}^{4} + 0.002777777777777778 \cdot {x}^{6}\right)} + 4.96031746031746 \cdot 10^{-05} \cdot {x}^{8}\]

Reproduce

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

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

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