Average Error: 29.4 → 0.3
Time: 37.5s
Precision: 64
Internal Precision: 1344
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot x \le -0.005047858084321966:\\ \;\;\;\;\frac{\frac{e^{\left(a \cdot x\right) \cdot 3} \cdot e^{\left(a \cdot x\right) \cdot 3} - 1}{e^{\left(a \cdot x\right) \cdot 3} + 1}}{e^{a \cdot x} \cdot e^{a \cdot x} + \left(1 + e^{a \cdot x}\right)}\\ \mathbf{else}:\\ \;\;\;\;a \cdot x + \left(a \cdot \left(x \cdot \frac{1}{6}\right) + \frac{1}{2}\right) \cdot \left(\left(a \cdot x\right) \cdot \left(a \cdot x\right)\right)\\ \end{array}\]

Error

Bits error versus a

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.4
Target0.2
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;\left|a \cdot x\right| \lt \frac{1}{10}:\\ \;\;\;\;\left(a \cdot x\right) \cdot \left(1 + \left(\frac{a \cdot x}{2} + \frac{{\left(a \cdot x\right)}^{2}}{6}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{a \cdot x} - 1\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (* a x) < -0.005047858084321966

    1. Initial program 0.0

      \[e^{a \cdot x} - 1\]
    2. Initial simplification0.0

      \[\leadsto e^{a \cdot x} - 1\]
    3. Using strategy rm
    4. Applied flip3--0.0

      \[\leadsto \color{blue}{\frac{{\left(e^{a \cdot x}\right)}^{3} - {1}^{3}}{e^{a \cdot x} \cdot e^{a \cdot x} + \left(1 \cdot 1 + e^{a \cdot x} \cdot 1\right)}}\]
    5. Using strategy rm
    6. Applied pow-exp0.0

      \[\leadsto \frac{\color{blue}{e^{\left(a \cdot x\right) \cdot 3}} - {1}^{3}}{e^{a \cdot x} \cdot e^{a \cdot x} + \left(1 \cdot 1 + e^{a \cdot x} \cdot 1\right)}\]
    7. Using strategy rm
    8. Applied flip--0.0

      \[\leadsto \frac{\color{blue}{\frac{e^{\left(a \cdot x\right) \cdot 3} \cdot e^{\left(a \cdot x\right) \cdot 3} - {1}^{3} \cdot {1}^{3}}{e^{\left(a \cdot x\right) \cdot 3} + {1}^{3}}}}{e^{a \cdot x} \cdot e^{a \cdot x} + \left(1 \cdot 1 + e^{a \cdot x} \cdot 1\right)}\]

    if -0.005047858084321966 < (* a x)

    1. Initial program 44.5

      \[e^{a \cdot x} - 1\]
    2. Initial simplification44.5

      \[\leadsto e^{a \cdot x} - 1\]
    3. Taylor expanded around 0 14.2

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left({a}^{2} \cdot {x}^{2}\right) + \left(a \cdot x + \frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right)\right)}\]
    4. Simplified0.5

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

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

Runtime

Time bar (total: 37.5s)Debug logProfile

herbie shell --seed 2018249 
(FPCore (a x)
  :name "expax (section 3.5)"

  :herbie-target
  (if (< (fabs (* a x)) 1/10) (* (* a x) (+ 1 (+ (/ (* a x) 2) (/ (pow (* a x) 2) 6)))) (- (exp (* a x)) 1))

  (- (exp (* a x)) 1))