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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -0.035151046141674525

    1. Initial program 1.3

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

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

      \[\leadsto \color{blue}{\left(e^{x} + \frac{1}{e^{x}}\right) - 2}\]
    4. Simplified1.3

      \[\leadsto \color{blue}{e^{-x} + \left(e^{x} + -2\right)}\]

    if -0.035151046141674525 < x

    1. Initial program 29.5

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

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

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

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

Runtime

Time bar (total: 13.2s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes0.60.30.00.659.2%
herbie shell --seed 2018354 
(FPCore (x)
  :name "exp2 (problem 3.3.7)"

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

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