Average Error: 38.0 → 9.8
Time: 1.4m
Precision: 64
Ground Truth: 128
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot x \le -1.1501639825495647 \cdot 10^{-13}:\\ \;\;\;\;\frac{e^{x \cdot \left(a + a\right)} - {1}^2}{e^{a \cdot x} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a + a\right) \cdot \left(x \cdot \left(a \cdot x\right) - \left(-x\right)\right)}{e^{a \cdot x} + 1}\\ \end{array}\]

Error

Bits error versus a

Bits error versus x

Target

Original38.0
Comparison15.9
Herbie9.8
\[ \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) < -1.1501639825495647e-13

    1. Initial program 0.8

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

      \[\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.8

      \[\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.8

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

    if -1.1501639825495647e-13 < (* a x)

    1. Initial program 51.5

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left({\left(a \cdot x\right)}^2 + {\left(a \cdot x\right)}^2\right) - \left(0 - a \cdot \left(x + x\right)\right)}{1 + e^{a \cdot x}}}\]
    7. Applied taylor 22.4

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

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

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

Runtime

Total time: 1.4m Debug log

Please include this information when filing a bug report:

herbie --seed '#(1964145002 3596466598 2249905545 2281660312 2216507096 1439778181)'
(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))