Average Error: 58.6 → 0.1
Time: 13.4s
Precision: 64
Internal Precision: 1344
\[e^{x} - 1\]
\[\begin{array}{l} \mathbf{if}\;x \le 0.00021075315610014558:\\ \;\;\;\;x + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(e^{x} - 1\right) \cdot \left(e^{x} \cdot \sqrt{e^{x}} - 1\right)}{\left(\sqrt{e^{x}} - 1\right) \cdot \left(\sqrt{e^{x}} + \left(1 + e^{x}\right)\right)}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original58.6
Target0.5
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.00021075315610014558

    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.00021075315610014558 < x

    1. Initial program 2.9

      \[e^{x} - 1\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt3.8

      \[\leadsto \color{blue}{\sqrt{e^{x}} \cdot \sqrt{e^{x}}} - 1\]
    4. Applied difference-of-sqr-13.7

      \[\leadsto \color{blue}{\left(\sqrt{e^{x}} + 1\right) \cdot \left(\sqrt{e^{x}} - 1\right)}\]
    5. Using strategy rm
    6. Applied flip3--5.9

      \[\leadsto \left(\sqrt{e^{x}} + 1\right) \cdot \color{blue}{\frac{{\left(\sqrt{e^{x}}\right)}^{3} - {1}^{3}}{\sqrt{e^{x}} \cdot \sqrt{e^{x}} + \left(1 \cdot 1 + \sqrt{e^{x}} \cdot 1\right)}}\]
    7. Applied flip-+6.0

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

      \[\leadsto \color{blue}{\frac{\left(\sqrt{e^{x}} \cdot \sqrt{e^{x}} - 1 \cdot 1\right) \cdot \left({\left(\sqrt{e^{x}}\right)}^{3} - {1}^{3}\right)}{\left(\sqrt{e^{x}} - 1\right) \cdot \left(\sqrt{e^{x}} \cdot \sqrt{e^{x}} + \left(1 \cdot 1 + \sqrt{e^{x}} \cdot 1\right)\right)}}\]
    9. Simplified5.6

      \[\leadsto \frac{\color{blue}{\left(\sqrt{e^{x}} \cdot e^{x} - 1\right) \cdot \left(e^{x} - 1\right)}}{\left(\sqrt{e^{x}} - 1\right) \cdot \left(\sqrt{e^{x}} \cdot \sqrt{e^{x}} + \left(1 \cdot 1 + \sqrt{e^{x}} \cdot 1\right)\right)}\]
    10. Simplified5.4

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

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

Runtime

Time bar (total: 13.4s)Debug logProfile

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

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

  (- (exp x) 1))