Average Error: 33.9 → 0.2
Time: 7.1s
Precision: 64
Internal precision: 1408
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot x \le -2.0640327788152904 \cdot 10^{-11}:\\ \;\;\;\;{\left(\sqrt[3]{e^{a \cdot x} - 1}\right)}^3\\ \mathbf{else}:\\ \;\;\;\;x \cdot a + {\left(a \cdot x\right)}^2 \cdot \frac{1}{2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus x

Target

Original33.9
Comparison8.1
Herbie0.2
\[ \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.0640327788152904e-11

    1. Initial program 0.5

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

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

    if -2.0640327788152904e-11 < (* a x)

    1. Initial program 47.9

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

      \[\leadsto \left(1 + \left(\frac{1}{2} \cdot \left({a}^2 \cdot {x}^2\right) + a \cdot x\right)\right) - 1\]
    3. Taylor expanded around 0 43.5

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

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

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

Runtime

Time bar (total: 7.1s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1064651971 495577305 2200811460 13024471 864198081 231948279)'
(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))