Average Error: 14.7 → 0.0
Time: 10.8s
Precision: 64
Internal Precision: 320
$\sqrt{1 + {x}^{2}}$
$\begin{array}{l} \mathbf{if}\;x \le -1.3352415157792068 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \left(x + \frac{\frac{1}{2}}{x}\right)\\ \mathbf{elif}\;x \le 353.22601608574234:\\ \;\;\;\;\sqrt{x \cdot x + 1}\\ \mathbf{else}:\\ \;\;\;\;\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 3 regimes
2. ## if x < -1.3352415157792068e+154

1. Initial program 59.6

$\sqrt{1 + {x}^{2}}$
2. Initial simplification59.6

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

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

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

## if -1.3352415157792068e+154 < x < 353.22601608574234

1. Initial program 0.0

$\sqrt{1 + {x}^{2}}$
2. Initial simplification0.0

$\leadsto \sqrt{x \cdot x + 1}$

## if 353.22601608574234 < x

1. Initial program 28.8

$\sqrt{1 + {x}^{2}}$
2. Initial simplification28.8

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

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

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

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.3352415157792068 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \left(x + \frac{\frac{1}{2}}{x}\right)\\ \mathbf{elif}\;x \le 353.22601608574234:\\ \;\;\;\;\sqrt{x \cdot x + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(x + \frac{\frac{1}{2}}{x}\right) - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}\\ \end{array}$

# Runtime

Time bar (total: 10.8s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (x)
:name "sqrt(1+x^2)"
(sqrt (+ 1 (pow x 2))))