Average Error: 21.3 → 8.3
Time: 18.1s
Precision: 64
Internal Precision: 1344
$0.5 \cdot \left(1 + \frac{x}{\sqrt{1 + x \cdot x}}\right)$
$\begin{array}{l} \mathbf{if}\;x \le -4.7653083919534935 \cdot 10^{+76}:\\ \;\;\;\;\frac{0.5 \cdot x}{\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \left(x + \frac{\frac{1}{2}}{x}\right)} + 0.5\\ \mathbf{else}:\\ \;\;\;\;0.5 + \frac{0.5 \cdot x}{\left(x + \frac{\frac{1}{2}}{x}\right) - \frac{\frac{\frac{1}{8}}{x}}{x \cdot 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 < -4.7653083919534935e+76

1. Initial program 61.2

$0.5 \cdot \left(1 + \frac{x}{\sqrt{1 + x \cdot x}}\right)$
2. Initial simplification61.2

$\leadsto 0.5 + \frac{0.5 \cdot x}{\sqrt{1 + x \cdot x}}$
3. Taylor expanded around -inf 20.7

$\leadsto 0.5 + \frac{0.5 \cdot x}{\color{blue}{\frac{1}{8} \cdot \frac{1}{{x}^{3}} - \left(x + \frac{1}{2} \cdot \frac{1}{x}\right)}}$
4. Simplified20.7

$\leadsto 0.5 + \frac{0.5 \cdot x}{\color{blue}{\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \left(\frac{\frac{1}{2}}{x} + x\right)}}$

## if -4.7653083919534935e+76 < x

1. Initial program 12.1

$0.5 \cdot \left(1 + \frac{x}{\sqrt{1 + x \cdot x}}\right)$
2. Initial simplification12.1

$\leadsto 0.5 + \frac{0.5 \cdot x}{\sqrt{1 + x \cdot x}}$
3. Taylor expanded around inf 5.4

$\leadsto 0.5 + \frac{0.5 \cdot x}{\color{blue}{\left(x + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{1}{8} \cdot \frac{1}{{x}^{3}}}}$
4. Simplified5.4

$\leadsto 0.5 + \frac{0.5 \cdot x}{\color{blue}{\left(x + \frac{\frac{1}{2}}{x}\right) - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}}}$
3. Recombined 2 regimes into one program.
4. Final simplification8.3

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.7653083919534935 \cdot 10^{+76}:\\ \;\;\;\;\frac{0.5 \cdot x}{\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \left(x + \frac{\frac{1}{2}}{x}\right)} + 0.5\\ \mathbf{else}:\\ \;\;\;\;0.5 + \frac{0.5 \cdot x}{\left(x + \frac{\frac{1}{2}}{x}\right) - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}}\\ \end{array}$

# Runtime

Time bar (total: 18.1s)Debug log

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