Average Error: 32.6 → 29.9
Time: 2.1m
Precision: 64
Internal Precision: 3392
$\sqrt{0.5 \cdot \left(\frac{q - r}{\sqrt{p + {\left(q - r\right)}^{2}}} + 1\right)}$
$\begin{array}{l} \mathbf{if}\;q - r \le -7.516080057550844 \cdot 10^{+165}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(\frac{q - r}{r - q} + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(\sqrt{\frac{q - r}{\sqrt{p + {\left(q - r\right)}^{2}}} + 1} \cdot \sqrt{\frac{q - r}{\sqrt{p + {\left(q - r\right)}^{2}}} + 1}\right)}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if (- q r) < -7.516080057550844e+165

1. Initial program 61.4

$\sqrt{0.5 \cdot \left(\frac{q - r}{\sqrt{p + {\left(q - r\right)}^{2}}} + 1\right)}$
2. Taylor expanded around 0 43.5

$\leadsto \sqrt{0.5 \cdot \left(\frac{q - r}{\color{blue}{r - q}} + 1\right)}$

## if -7.516080057550844e+165 < (- q r)

1. Initial program 27.4

$\sqrt{0.5 \cdot \left(\frac{q - r}{\sqrt{p + {\left(q - r\right)}^{2}}} + 1\right)}$
2. Using strategy rm
$\leadsto \sqrt{0.5 \cdot \color{blue}{\left(\sqrt{\frac{q - r}{\sqrt{p + {\left(q - r\right)}^{2}}} + 1} \cdot \sqrt{\frac{q - r}{\sqrt{p + {\left(q - r\right)}^{2}}} + 1}\right)}}$
herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'