Average Error: 50.3 → 0.3
Time: 18.6s
Precision: 64
Internal Precision: 2368
$\frac{\left(x + e^{-x}\right) - 1}{x \cdot x}$
$\begin{array}{l} \mathbf{if}\;x \le 0.001484896875491536:\\ \;\;\;\;\left({x}^{2} \cdot \frac{1}{24} + \frac{1}{2}\right) - \frac{1}{6} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(x - 1\right) + e^{-x}}{x}}{x}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if x < 0.001484896875491536

1. Initial program 61.0

$\frac{\left(x + e^{-x}\right) - 1}{x \cdot x}$
2. Initial simplification61.0

$\leadsto \frac{\left(x - 1\right) + e^{-x}}{x \cdot x}$
3. Taylor expanded around 0 0.5

$\leadsto \color{blue}{\left(\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}\right) - \frac{1}{6} \cdot x}$

## if 0.001484896875491536 < x

1. Initial program 29.0

$\frac{\left(x + e^{-x}\right) - 1}{x \cdot x}$
2. Initial simplification29.0

$\leadsto \frac{\left(x - 1\right) + e^{-x}}{x \cdot x}$
3. Using strategy rm
4. Applied associate-/r*0.1

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

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

# Runtime

Time bar (total: 18.6s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (x)
:name "(x+exp(-x) - 1)/(x*x)"
(/ (- (+ x (exp (- x))) 1) (* x x)))