Average Error: 22.8 → 11.5
Time: 16.1s
Precision: 64
Internal Precision: 3392
$\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{a + x \cdot x}}\right)}$
$\begin{array}{l} \mathbf{if}\;x \le -3.9125559251917 \cdot 10^{+79}:\\ \;\;\;\;\sqrt{0.5 + \frac{0.5 \cdot x}{\frac{a}{x} \cdot \left(-\frac{1}{2}\right) + \left(-x\right)}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 + \frac{0.5 \cdot x}{x + \frac{a}{x} \cdot \frac{1}{2}}}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if x < -3.9125559251917e+79

1. Initial program 58.5

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

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

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

## if -3.9125559251917e+79 < x

1. Initial program 16.4

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

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

$\leadsto \sqrt{0.5 + \frac{0.5 \cdot x}{\color{blue}{x + \frac{1}{2} \cdot \frac{a}{x}}}}$
3. Recombined 2 regimes into one program.
4. Final simplification11.5

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

# Runtime

Time bar (total: 16.1s)Debug log

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