Average Error: 29.7 → 0.6
Time: 5.9s
Precision: 64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)} \cdot \sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)}\]
\left(e^{x} - 2\right) + e^{-x}
\sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)} \cdot \sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)}
double code(double x) {
	return ((exp(x) - 2.0) + exp(-x));
}
double code(double x) {
	return (sqrt((pow(x, 2.0) + ((0.002777777777777778 * pow(x, 6.0)) + (0.08333333333333333 * pow(x, 4.0))))) * sqrt((pow(x, 2.0) + ((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.1
Herbie0.6
\[4 \cdot {\left(\sinh \left(\frac{x}{2}\right)\right)}^{2}\]

Derivation

  1. Initial program 29.7

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

    \[\leadsto \color{blue}{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.6

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

    \[\leadsto \sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)} \cdot \sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)}\]

Reproduce

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

  :herbie-target
  (* 4 (pow (sinh (/ x 2)) 2))

  (+ (- (exp x) 2) (exp (- x))))