Average Error: 29.8 → 2.9
Time: 21.4s
Precision: 64
Internal Precision: 1408
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot x \le -7.255767592865645 \cdot 10^{-07}:\\ \;\;\;\;e^{a \cdot x} - 1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(a + \left(\frac{1}{2} \cdot x\right) \cdot \left(a \cdot a\right)\right)\\ \end{array}\]

Error

Bits error versus a

Bits error versus x

Target

Original29.8
Target0.2
Herbie2.9
\[\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) < -7.255767592865645e-07

    1. Initial program 0.1

      \[e^{a \cdot x} - 1\]
    2. Using strategy rm
    3. Applied add-cbrt-cube0.1

      \[\leadsto \color{blue}{\sqrt[3]{\left(\left(e^{a \cdot x} - 1\right) \cdot \left(e^{a \cdot x} - 1\right)\right) \cdot \left(e^{a \cdot x} - 1\right)}}\]
    4. Applied simplify0.1

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

    if -7.255767592865645e-07 < (* a x)

    1. Initial program 44.7

      \[e^{a \cdot x} - 1\]
    2. Taylor expanded around 0 13.9

      \[\leadsto \color{blue}{\frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right) + \left(\frac{1}{2} \cdot \left({a}^{2} \cdot {x}^{2}\right) + a \cdot x\right)}\]
    3. Taylor expanded around inf 8.1

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

      \[\leadsto \color{blue}{x \cdot a + \left(x \cdot a\right) \cdot \left(\frac{1}{2} \cdot \left(x \cdot a\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.
  5. Applied simplify2.9

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;a \cdot x \le -7.255767592865645 \cdot 10^{-07}:\\ \;\;\;\;e^{a \cdot x} - 1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(a + \left(\frac{1}{2} \cdot x\right) \cdot \left(a \cdot a\right)\right)\\ \end{array}}\]

Runtime

Time bar (total: 21.4s)Debug log

herbie shell --seed '#(633950927 2092594946 1442981 2827247922 2812758452 390991499)' 
(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))