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}\]

Error

Bits error versus q

Bits error versus r

Bits error versus p

Try it out

Your Program's Arguments

Results

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
    3. Applied add-sqr-sqrt27.4

      \[\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)}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 2.1m)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (q r p)
  :name "sqrt(.5*((q-r)/sqrt(p +(q-r)^2) +1))"
  (sqrt (* 0.5 (+ (/ (- q r) (sqrt (+ p (pow (- q r) 2)))) 1))))