Average Error: 32.3 → 12.1
Time: 11.4s
Precision: 64
Internal precision: 1408
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot x \le -4.283222210193013 \cdot 10^{-14}:\\ \;\;\;\;\frac{e^{a \cdot \left(x + x\right)} - {1}^2}{{\left(\sqrt{e^{a \cdot x} + 1}\right)}^2}\\ \mathbf{else}:\\ \;\;\;\;\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)\\ \end{array}\]

Error

Bits error versus a

Bits error versus x

Target

Original32.3
Comparison5.6
Herbie12.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) < -4.283222210193013e-14

    1. Initial program 0.9

      \[e^{a \cdot x} - 1\]
    2. Using strategy rm
    3. Applied flip-- 0.9

      \[\leadsto \color{blue}{\frac{{\left(e^{a \cdot x}\right)}^2 - {1}^2}{e^{a \cdot x} + 1}}\]
    4. Using strategy rm
    5. Applied add-exp-log 0.9

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

      \[\leadsto \frac{e^{\color{blue}{a \cdot \left(x + x\right)}} - {1}^2}{e^{a \cdot x} + 1}\]
    7. Using strategy rm
    8. Applied add-sqr-sqrt 0.9

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

    if -4.283222210193013e-14 < (* a x)

    1. Initial program 46.9

      \[e^{a \cdot x} - 1\]
    2. Applied taylor 17.3

      \[\leadsto \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 0 17.3

      \[\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. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 11.4s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1066372953 114334025 411438303 1288252006 2962405338 2829794477)'
(FPCore (a x)
  :name "expax (section 3.5)"

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

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