Average Error: 58.5 → 0.1
Time: 32.5s
Precision: 64
Internal Precision: 128
\[e^{x} - 1\]
\[\begin{array}{l} \mathbf{if}\;x \le 0.00011941122859938984:\\ \;\;\;\;x + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot 3}}{e^{x + x} + \left(e^{x} + 1\right)} - \frac{1}{e^{x} \cdot e^{x} + \left(e^{x} + 1\right)}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original58.5
Target0.6
Herbie0.1
\[x \cdot \left(\left(1 + \frac{x}{2}\right) + \frac{x \cdot x}{6}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if x < 0.00011941122859938984

    1. Initial program 59.2

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

      \[\leadsto \color{blue}{x + \left(\frac{1}{6} \cdot {x}^{3} + \frac{1}{2} \cdot {x}^{2}\right)}\]
    3. Simplified0.0

      \[\leadsto \color{blue}{x + \left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot \left(x \cdot x\right)}\]

    if 0.00011941122859938984 < x

    1. Initial program 2.7

      \[e^{x} - 1\]
    2. Using strategy rm
    3. Applied flip3--7.4

      \[\leadsto \color{blue}{\frac{{\left(e^{x}\right)}^{3} - {1}^{3}}{e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)}}\]
    4. Using strategy rm
    5. Applied pow-exp7.9

      \[\leadsto \frac{\color{blue}{e^{x \cdot 3}} - {1}^{3}}{e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)}\]
    6. Using strategy rm
    7. Applied div-sub7.9

      \[\leadsto \color{blue}{\frac{e^{x \cdot 3}}{e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)} - \frac{{1}^{3}}{e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)}}\]
    8. Simplified8.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 0.00011941122859938984:\\ \;\;\;\;x + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot 3}}{e^{x + x} + \left(e^{x} + 1\right)} - \frac{1}{e^{x} \cdot e^{x} + \left(e^{x} + 1\right)}\\ \end{array}\]

Runtime

Time bar (total: 32.5s)Debug logProfile

herbie shell --seed 2018336 
(FPCore (x)
  :name "expm1 (example 3.7)"
  :pre (< -0.00017 x)

  :herbie-target
  (* x (+ (+ 1 (/ x 2)) (/ (* x x) 6)))

  (- (exp x) 1))