Average Error: 58.9 → 0.0
Time: 5.7s
Precision: 64
Internal precision: 1408
\[e^{x} - 1\]
\[\begin{array}{l} \mathbf{if}\;x \le 0.12609879998858392:\\ \;\;\;\;{x}^2 \cdot \left(\frac{1}{2} + x \cdot \frac{1}{6}\right) + x\\ \mathbf{else}:\\ \;\;\;\;e^{x} - 1\\ \end{array}\]

Error

Bits error versus x

Target

Original58.9
Comparison0.4
Herbie0.0
\[ x \cdot \left(\left(1 + \frac{x}{2}\right) + \frac{{x}^2}{6}\right) \]

Derivation

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

    1. Initial program 59.3

      \[e^{x} - 1\]
    2. Applied taylor 0.0

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

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

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

    if 0.12609879998858392 < x

    1. Initial program 0.3

      \[e^{x} - 1\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 5.7s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1067488128 1186562765 67428877 2948030040 4169093828 3206893112)'
(FPCore (x)
  :name "expm1 (example 3.7)"
  :pre (< -0.00017 x)

  :target
  (* x (+ (+ 1 (/ x 2)) (/ (sqr x) 6)))

  (- (exp x) 1))