Average Error: 29.9 → 0.7
Time: 10.9s
Precision: binary64
Cost: 6912
\[\left(e^{x} - 2\right) + e^{-x}\]
\[x \cdot x + 0.08333333333333333 \cdot {x}^{4}\]
\left(e^{x} - 2\right) + e^{-x}
x \cdot x + 0.08333333333333333 \cdot {x}^{4}
(FPCore (x) :precision binary64 (+ (- (exp x) 2.0) (exp (- x))))
(FPCore (x)
 :precision binary64
 (+ (* x x) (* 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.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.9
Target0.0
Herbie0.7
\[4 \cdot {\sinh \left(\frac{x}{2}\right)}^{2}\]

Alternatives

Alternative 1
Error30.0
Cost58944
\[\frac{{\left(e^{x} - 2\right)}^{3} + {\left(e^{x}\right)}^{-3}}{{\left(e^{x}\right)}^{-2} + \left(e^{x} - 2\right) \cdot \left(\left(e^{x} - 2\right) - e^{-x}\right)}\]
Alternative 2
Error30.0
Cost46080
\[\frac{4 + e^{x} \cdot \left(e^{x} + \left({\left(e^{x}\right)}^{3} + -6\right)\right)}{e^{x} \cdot \left(4 + e^{x} \cdot \left(e^{x} + 2\right)\right)}\]
Alternative 3
Error29.9
Cost39488
\[\frac{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) - {\left(e^{x}\right)}^{-2}}{\left(e^{x} - 2\right) - e^{-x}}\]
Alternative 4
Error29.9
Cost39232
\[\sqrt{e^{-x} + \left(e^{x} - 2\right)} \cdot \sqrt{e^{-x} + \left(e^{x} - 2\right)}\]
Alternative 5
Error30.0
Cost32896
\[\frac{\left(2 + {\left(e^{x}\right)}^{3}\right) + e^{x} \cdot -3}{e^{x} \cdot \left(e^{x} + 2\right)}\]
Alternative 6
Error52.8
Cost27072
\[\frac{1}{\frac{{x}^{4} + {x}^{6} \cdot \left(\left(x \cdot x\right) \cdot 0.006944444444444444 - 0.08333333333333333\right)}{0.0005787037037037037 \cdot {x}^{12} + {x}^{6}}}\]
Alternative 7
Error52.7
Cost26944
\[\frac{0.0005787037037037037 \cdot {x}^{12} + {x}^{6}}{{x}^{4} + {x}^{6} \cdot \left(\left(x \cdot x\right) \cdot 0.006944444444444444 - 0.08333333333333333\right)}\]
Alternative 8
Error52.8
Cost26560
\[\frac{0.0005787037037037037 \cdot {x}^{12} + {x}^{6}}{{x}^{4} + {x}^{6} \cdot -0.08333333333333333}\]
Alternative 9
Error30.0
Cost26048
\[\sqrt[3]{{\left(e^{-x} + \left(e^{x} - 2\right)\right)}^{3}}\]
Alternative 10
Error29.9
Cost25984
\[e^{\log \left(e^{-x} + \left(e^{x} - 2\right)\right)}\]
Alternative 11
Error30.3
Cost25984
\[\log \left(e^{e^{-x} + \left(e^{x} - 2\right)}\right)\]
Alternative 12
Error20.8
Cost19776
\[\sqrt[3]{{\left(x \cdot x + 0.08333333333333333 \cdot {x}^{4}\right)}^{3}}\]
Alternative 13
Error29.9
Cost13184
\[e^{x} - \left(2 - e^{-x}\right)\]
Alternative 14
Error29.9
Cost13184
\[e^{-x} + \left(e^{x} - 2\right)\]
Alternative 15
Error31.1
Cost6656
\[-1 + e^{-x}\]
Alternative 16
Error1.1
Cost192
\[x \cdot x\]
Alternative 17
Error61.2
Cost64
\[1\]
Alternative 18
Error31.4
Cost64
\[0\]
Alternative 19
Error62.3
Cost64
\[-1\]

Error

Derivation

  1. Initial program 29.9

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

    \[\leadsto \color{blue}{{x}^{2} + 0.08333333333333333 \cdot {x}^{4}}\]
  3. Simplified0.7

    \[\leadsto \color{blue}{x \cdot x + 0.08333333333333333 \cdot {x}^{4}}\]
  4. Simplified0.7

    \[\leadsto \color{blue}{x \cdot x + 0.08333333333333333 \cdot {x}^{4}}\]
  5. Final simplification0.7

    \[\leadsto x \cdot x + 0.08333333333333333 \cdot {x}^{4}\]

Reproduce

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