Average Error: 33.3 → 18.2
Time: 1.9m
Precision: 64
Internal Precision: 4160
\[\sqrt{0.5 \cdot \left(1 + \frac{x - y}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}}\right)}\]
\[\begin{array}{l} \mathbf{if}\;\sqrt{0.5 \cdot \frac{1 - \frac{\left(x - y\right) \cdot \left(x - y\right)}{x \cdot p + \left(x - y\right) \cdot \left(x - y\right)}}{1 - \frac{x - y}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}}}} \le 1.0281445999809498:\\ \;\;\;\;\sqrt{0.5 \cdot \left(\left(1 + \frac{x}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}}\right) - \frac{y}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot 2}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

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 (sqrt (* 0.5 (/ (- 1 (/ (* (- x y) (- x y)) (+ (* x p) (* (- x y) (- x y))))) (- 1 (/ (- x y) (sqrt (+ (* p x) (* (- x y) (- x y))))))))) < 1.0281445999809498

    1. Initial program 25.0

      \[\sqrt{0.5 \cdot \left(1 + \frac{x - y}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}}\right)}\]
    2. Using strategy rm
    3. Applied div-sub25.0

      \[\leadsto \sqrt{0.5 \cdot \left(1 + \color{blue}{\left(\frac{x}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}} - \frac{y}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}}\right)}\right)}\]
    4. Applied associate-+r-24.9

      \[\leadsto \sqrt{0.5 \cdot \color{blue}{\left(\left(1 + \frac{x}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}}\right) - \frac{y}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}}\right)}}\]

    if 1.0281445999809498 < (sqrt (* 0.5 (/ (- 1 (/ (* (- x y) (- x y)) (+ (* x p) (* (- x y) (- x y))))) (- 1 (/ (- x y) (sqrt (+ (* p x) (* (- x y) (- x y)))))))))

    1. Initial program 36.5

      \[\sqrt{0.5 \cdot \left(1 + \frac{x - y}{\sqrt{p \cdot x + \left(x - y\right) \cdot \left(x - y\right)}}\right)}\]
    2. Taylor expanded around inf 15.5

      \[\leadsto \sqrt{0.5 \cdot \color{blue}{2}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 1.9m)Debug log

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