Average Error: 21.1 → 1.4
Time: 28.2s
Precision: 64
Internal Precision: 2368
$\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{100000.0 + x \cdot x}}\right)}$
$\begin{array}{l} \mathbf{if}\;x \le -218.24495696644937:\\ \;\;\;\;\left(\frac{4.39453125 \cdot 10^{+17}}{25000.0} - 78125000000000.0\right) \cdot \frac{\frac{1}{\sqrt{25000.0}}}{{x}^{5}} + \left(\frac{\frac{937500000.0}{x}}{\left(x \cdot x\right) \cdot \sqrt{25000.0}} - \frac{\sqrt{25000.0}}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 + \frac{x \cdot 0.5}{\left(\frac{50000.0}{x} + x\right) - \frac{\frac{1250000000.0}{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 < -218.24495696644937

1. Initial program 60.5

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

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

$\leadsto \color{blue}{\left(4.39453125 \cdot 10^{+17} \cdot \frac{1}{{\left(\sqrt{25000.0}\right)}^{3} \cdot {x}^{5}} + 937500000.0 \cdot \frac{1}{\sqrt{25000.0} \cdot {x}^{3}}\right) - \left(\frac{\sqrt{25000.0}}{x} + 78125000000000.0 \cdot \frac{1}{\sqrt{25000.0} \cdot {x}^{5}}\right)}$
4. Simplified0.8

$\leadsto \color{blue}{\frac{\frac{1}{\sqrt{25000.0}}}{{x}^{5}} \cdot \left(\frac{4.39453125 \cdot 10^{+17}}{25000.0} - 78125000000000.0\right) + \left(\frac{\frac{937500000.0}{x}}{\sqrt{25000.0} \cdot \left(x \cdot x\right)} - \frac{\sqrt{25000.0}}{x}\right)}$

## if -218.24495696644937 < x

1. Initial program 8.2

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

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

$\leadsto \sqrt{0.5 + \frac{0.5 \cdot x}{\color{blue}{\left(x + 50000.0 \cdot \frac{1}{x}\right) - 1250000000.0 \cdot \frac{1}{{x}^{3}}}}}$
4. Simplified1.6

$\leadsto \sqrt{0.5 + \frac{0.5 \cdot x}{\color{blue}{\left(x + \frac{50000.0}{x}\right) - \frac{\frac{1250000000.0}{x}}{x \cdot x}}}}$
3. Recombined 2 regimes into one program.
4. Final simplification1.4

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -218.24495696644937:\\ \;\;\;\;\left(\frac{4.39453125 \cdot 10^{+17}}{25000.0} - 78125000000000.0\right) \cdot \frac{\frac{1}{\sqrt{25000.0}}}{{x}^{5}} + \left(\frac{\frac{937500000.0}{x}}{\left(x \cdot x\right) \cdot \sqrt{25000.0}} - \frac{\sqrt{25000.0}}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 + \frac{x \cdot 0.5}{\left(\frac{50000.0}{x} + x\right) - \frac{\frac{1250000000.0}{x}}{x \cdot x}}}\\ \end{array}$

# Runtime

Time bar (total: 28.2s)Debug log

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