Average Error: 29.0 → 0.3
Time: 22.7s
Precision: 64
Internal Precision: 1408
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;e^{a \cdot x} - 1 \le -1.9006245653607752 \cdot 10^{-06}:\\ \;\;\;\;\log \left(e^{e^{a \cdot x} - 1}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{6} \cdot {\left(a \cdot x\right)}^{3} + \left(\frac{1}{2} \cdot {\left(a \cdot x\right)}^{2} + a \cdot x\right)\\ \end{array}\]

Error

Bits error versus a

Bits error versus x

Target

Original29.0
Target0.1
Herbie0.3
\[\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 (- (exp (* a x)) 1) < -1.9006245653607752e-06

    1. Initial program 0.1

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

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

    if -1.9006245653607752e-06 < (- (exp (* a x)) 1)

    1. Initial program 44.0

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

      \[\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. Using strategy rm
    4. Applied pow-prod-down7.7

      \[\leadsto \frac{1}{6} \cdot \color{blue}{{\left(a \cdot x\right)}^{3}} + \left(\frac{1}{2} \cdot \left({a}^{2} \cdot {x}^{2}\right) + a \cdot x\right)\]
    5. Using strategy rm
    6. Applied pow-prod-down0.4

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

Runtime

Time bar (total: 22.7s)Debug logProfile

herbie shell --seed '#(1070355188 2193211668 3977393919 3454156579 3755371326 1656365382)' 
(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))