Average Error: 32.7 → 1.1
Time: 56.8s
Precision: 64
Internal Precision: 1408
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot x \le -2.9086861004764906 \cdot 10^{-20}:\\ \;\;\;\;\log \left(e^{e^{a \cdot x} - 1}\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\left(\left(a \cdot x\right) \cdot \left(a \cdot x\right)\right) \cdot \left(x \cdot \left(\frac{1}{6} \cdot a\right) + \frac{1}{2}\right)\right)} + a \cdot x\\ \end{array}\]

Error

Bits error versus a

Bits error versus x

Target

Original32.7
Target6.0
Herbie1.1
\[\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) < -2.9086861004764906e-20

    1. Initial program 1.8

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

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

    if -2.9086861004764906e-20 < (* a x)

    1. Initial program 47.4

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

      \[\leadsto \color{blue}{\log \left(e^{e^{a \cdot x} - 1}\right)}\]
    4. Taylor expanded around 0 47.9

      \[\leadsto \log \left(e^{\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)}}\right)\]
    5. Applied simplify14.3

      \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left({x}^{3} \cdot \left(a \cdot \frac{1}{6}\right) + x \cdot \left(\frac{1}{2} \cdot x\right)\right) + a \cdot x}\]
    6. Using strategy rm
    7. Applied add-exp-log14.6

      \[\leadsto \color{blue}{e^{\log \left(\left(a \cdot a\right) \cdot \left({x}^{3} \cdot \left(a \cdot \frac{1}{6}\right) + x \cdot \left(\frac{1}{2} \cdot x\right)\right)\right)}} + a \cdot x\]
    8. Applied simplify0.8

      \[\leadsto e^{\color{blue}{\log \left(\left(\left(a \cdot x\right) \cdot \left(a \cdot x\right)\right) \cdot \left(x \cdot \left(\frac{1}{6} \cdot a\right) + \frac{1}{2}\right)\right)}} + a \cdot x\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 56.8s)Debug logProfile

herbie shell --seed '#(1062930989 876886121 3990119081 3032829768 3060892583 1929069376)' 
(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))