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

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

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

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

    \[\leadsto \sqrt[3]{\color{blue}{{\left(0.08333333333333333 \cdot {x}^{4} + \left(0.002777777777777778 \cdot {x}^{6} + \left(4.96031746031746 \cdot 10^{-5} \cdot {x}^{8} + x \cdot x\right)\right)\right)}^{3}}} \]
  7. Using strategy rm
  8. Applied *-un-lft-identity_binary6420.7

    \[\leadsto \sqrt[3]{{\color{blue}{\left(1 \cdot \left(0.08333333333333333 \cdot {x}^{4} + \left(0.002777777777777778 \cdot {x}^{6} + \left(4.96031746031746 \cdot 10^{-5} \cdot {x}^{8} + x \cdot x\right)\right)\right)\right)}}^{3}} \]
  9. Applied unpow-prod-down_binary6420.7

    \[\leadsto \sqrt[3]{\color{blue}{{1}^{3} \cdot {\left(0.08333333333333333 \cdot {x}^{4} + \left(0.002777777777777778 \cdot {x}^{6} + \left(4.96031746031746 \cdot 10^{-5} \cdot {x}^{8} + x \cdot x\right)\right)\right)}^{3}}} \]
  10. Applied cbrt-prod_binary6420.7

    \[\leadsto \color{blue}{\sqrt[3]{{1}^{3}} \cdot \sqrt[3]{{\left(0.08333333333333333 \cdot {x}^{4} + \left(0.002777777777777778 \cdot {x}^{6} + \left(4.96031746031746 \cdot 10^{-5} \cdot {x}^{8} + x \cdot x\right)\right)\right)}^{3}}} \]
  11. Simplified20.7

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

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

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

Reproduce

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