Average Error: 33.2 → 1.1
Time: 57.8s
Precision: 64
Ground Truth: 128
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot x \le -3.4479820948686526 \cdot 10^{-05}:\\ \;\;\;\;\log \left(\frac{e^{e^{x \cdot a}}}{e}\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(\left(x \cdot a\right) \cdot x\right) \cdot \left(a \cdot \left(\frac{1}{6} \cdot x\right) + \frac{1}{2}\right)\right) + a \cdot x\\ \end{array}\]

Error

Bits error versus a

Bits error versus x

Target

Original33.2
Comparison6.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) < -3.4479820948686526e-05

    1. Initial program 0.0

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

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

      \[\leadsto \color{blue}{\log \left(e^{{\left(\sqrt[3]{e^{a \cdot x} - 1}\right)}^3}\right)}\]
    6. Applied simplify 0.1

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

    if -3.4479820948686526e-05 < (* a x)

    1. Initial program 47.4

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

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

      \[\leadsto {\left(\sqrt[3]{\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)}^3\]
    5. Taylor expanded around 0 19.1

      \[\leadsto {\left(\sqrt[3]{\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)}^3\]
    6. Applied simplify 15.1

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

      \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(x \cdot \left(\frac{1}{2} \cdot x\right) + {x}^3 \cdot \left(a \cdot \frac{1}{6}\right)\right) + a \cdot x\]
    9. Applied associate-*l* 11.5

      \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(x \cdot \left(\frac{1}{2} \cdot x\right) + {x}^3 \cdot \left(a \cdot \frac{1}{6}\right)\right)\right)} + a \cdot x\]
    10. Applied simplify 1.5

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

Runtime

Total time: 57.8s Debug log

Please include this information when filing a bug report:

herbie --seed '#(1978528943 2525562504 2475963685 4220017964 1331650906 2560157971)'
(FPCore (a x)
  :name "NMSE 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))