Average Error: 25.9 → 12.8
Time: 40.4s
Precision: 64
Internal Precision: 320
\[\sqrt{0.5 \cdot \left(1 + \frac{q - r}{2 \cdot \sqrt{p + {\left(q - r\right)}^{2}}}\right)}\]
\[\begin{array}{l} \mathbf{if}\;q - r \le -2.50943054587483 \cdot 10^{+155}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{q - r}{2 \cdot \left(r - q\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{q - r}{2 \cdot \sqrt{p + {\left(q - r\right)}^{2}}}\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) < -2.50943054587483e+155

    1. Initial program 50.7

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

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

    if -2.50943054587483e+155 < (- q r)

    1. Initial program 17.3

      \[\sqrt{0.5 \cdot \left(1 + \frac{q - r}{2 \cdot \sqrt{p + {\left(q - r\right)}^{2}}}\right)}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 40.4s)Debug log

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