Average Error: 29.9 → 0.0
Time: 19.6s
Precision: 64
Internal Precision: 1344
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\begin{array}{l} \mathbf{if}\;e^{-x} + \left(e^{x} - 2\right) \le 0.014331332012292242:\\ \;\;\;\;{x}^{2} + \left({x}^{4} \cdot \frac{1}{12} + \frac{1}{360} \cdot {x}^{6}\right)\\ \mathbf{else}:\\ \;\;\;\;e^{x} + \left(\left(-2\right) - \frac{-1}{e^{x}}\right)\\ \end{array}\]

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.0
\[4 \cdot {\left(\sinh \left(\frac{x}{2}\right)\right)}^{2}\]

Derivation

  1. Split input into 2 regimes
  2. if (+ (- (exp x) 2) (exp (- x))) < 0.014331332012292242

    1. Initial program 30.4

      \[\left(e^{x} - 2\right) + e^{-x}\]
    2. Initial simplification30.4

      \[\leadsto \left(e^{x} - 2\right) - \frac{-1}{e^{x}}\]
    3. Taylor expanded around 0 0.0

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

    if 0.014331332012292242 < (+ (- (exp x) 2) (exp (- x)))

    1. Initial program 0.6

      \[\left(e^{x} - 2\right) + e^{-x}\]
    2. Initial simplification0.6

      \[\leadsto \left(e^{x} - 2\right) - \frac{-1}{e^{x}}\]
    3. Using strategy rm
    4. Applied sub-neg0.6

      \[\leadsto \color{blue}{\left(e^{x} + \left(-2\right)\right)} - \frac{-1}{e^{x}}\]
    5. Applied associate--l+0.6

      \[\leadsto \color{blue}{e^{x} + \left(\left(-2\right) - \frac{-1}{e^{x}}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-x} + \left(e^{x} - 2\right) \le 0.014331332012292242:\\ \;\;\;\;{x}^{2} + \left({x}^{4} \cdot \frac{1}{12} + \frac{1}{360} \cdot {x}^{6}\right)\\ \mathbf{else}:\\ \;\;\;\;e^{x} + \left(\left(-2\right) - \frac{-1}{e^{x}}\right)\\ \end{array}\]

Runtime

Time bar (total: 19.6s)Debug logProfile

herbie shell --seed 2018215 
(FPCore (x)
  :name "exp2 (problem 3.3.7)"

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

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