1/(sqrt((x + 1) * (y + 1)) - sqrt(x * y))

Percentage Accurate: 84.4% → 98.6%
Time: 6.1s
Alternatives: 11
Speedup: 0.4×

Specification

?
\[\left(1000 \leq x \land x \leq 1000000000\right) \land \left(0 \leq y \land y \leq 1.79 \cdot 10^{+308}\right)\]
\[\begin{array}{l} \\ \frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ 1.0 (- (sqrt (* (+ x 1.0) (+ y 1.0))) (sqrt (* x y)))))
double code(double x, double y) {
	return 1.0 / (sqrt(((x + 1.0) * (y + 1.0))) - sqrt((x * y)));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 / (sqrt(((x + 1.0d0) * (y + 1.0d0))) - sqrt((x * y)))
end function
public static double code(double x, double y) {
	return 1.0 / (Math.sqrt(((x + 1.0) * (y + 1.0))) - Math.sqrt((x * y)));
}
def code(x, y):
	return 1.0 / (math.sqrt(((x + 1.0) * (y + 1.0))) - math.sqrt((x * y)))
function code(x, y)
	return Float64(1.0 / Float64(sqrt(Float64(Float64(x + 1.0) * Float64(y + 1.0))) - sqrt(Float64(x * y))))
end
function tmp = code(x, y)
	tmp = 1.0 / (sqrt(((x + 1.0) * (y + 1.0))) - sqrt((x * y)));
end
code[x_, y_] := N[(1.0 / N[(N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 84.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ 1.0 (- (sqrt (* (+ x 1.0) (+ y 1.0))) (sqrt (* x y)))))
double code(double x, double y) {
	return 1.0 / (sqrt(((x + 1.0) * (y + 1.0))) - sqrt((x * y)));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 / (sqrt(((x + 1.0d0) * (y + 1.0d0))) - sqrt((x * y)))
end function
public static double code(double x, double y) {
	return 1.0 / (Math.sqrt(((x + 1.0) * (y + 1.0))) - Math.sqrt((x * y)));
}
def code(x, y):
	return 1.0 / (math.sqrt(((x + 1.0) * (y + 1.0))) - math.sqrt((x * y)))
function code(x, y)
	return Float64(1.0 / Float64(sqrt(Float64(Float64(x + 1.0) * Float64(y + 1.0))) - sqrt(Float64(x * y))))
end
function tmp = code(x, y)
	tmp = 1.0 / (sqrt(((x + 1.0) * (y + 1.0))) - sqrt((x * y)));
end
code[x_, y_] := N[(1.0 / N[(N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}}
\end{array}

Alternative 1: 98.6% accurate, 0.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 950:\\ \;\;\;\;{\left(\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{y} \cdot \sqrt{x}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \frac{\mathsf{fma}\left(-0.125, \sqrt{\frac{{x}^{-1}}{y}}, \mathsf{fma}\left(-0.0390625, \sqrt{{\left({x}^{5} \cdot y\right)}^{-1}}, \mathsf{fma}\left(0.5, \sqrt{\frac{x}{y}}, 0.0625 \cdot \sqrt{{\left({x}^{3} \cdot y\right)}^{-1}}\right)\right)\right)}{x}\right) \cdot y\right)}^{-1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x 950.0)
   (pow (- (sqrt (* (+ x 1.0) (+ y 1.0))) (* (sqrt y) (sqrt x))) -1.0)
   (pow
    (*
     (+
      (fma
       (sqrt (/ (+ 1.0 x) (pow y 7.0)))
       0.0625
       (fma
        (sqrt (/ (+ 1.0 x) (pow y 5.0)))
        -0.125
        (* (sqrt (/ (+ 1.0 x) (pow y 3.0))) 0.5)))
      (/
       (fma
        -0.125
        (sqrt (/ (pow x -1.0) y))
        (fma
         -0.0390625
         (sqrt (pow (* (pow x 5.0) y) -1.0))
         (fma
          0.5
          (sqrt (/ x y))
          (* 0.0625 (sqrt (pow (* (pow x 3.0) y) -1.0))))))
       x))
     y)
    -1.0)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= 950.0) {
		tmp = pow((sqrt(((x + 1.0) * (y + 1.0))) - (sqrt(y) * sqrt(x))), -1.0);
	} else {
		tmp = pow(((fma(sqrt(((1.0 + x) / pow(y, 7.0))), 0.0625, fma(sqrt(((1.0 + x) / pow(y, 5.0))), -0.125, (sqrt(((1.0 + x) / pow(y, 3.0))) * 0.5))) + (fma(-0.125, sqrt((pow(x, -1.0) / y)), fma(-0.0390625, sqrt(pow((pow(x, 5.0) * y), -1.0)), fma(0.5, sqrt((x / y)), (0.0625 * sqrt(pow((pow(x, 3.0) * y), -1.0)))))) / x)) * y), -1.0);
	}
	return tmp;
}
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= 950.0)
		tmp = Float64(sqrt(Float64(Float64(x + 1.0) * Float64(y + 1.0))) - Float64(sqrt(y) * sqrt(x))) ^ -1.0;
	else
		tmp = Float64(Float64(fma(sqrt(Float64(Float64(1.0 + x) / (y ^ 7.0))), 0.0625, fma(sqrt(Float64(Float64(1.0 + x) / (y ^ 5.0))), -0.125, Float64(sqrt(Float64(Float64(1.0 + x) / (y ^ 3.0))) * 0.5))) + Float64(fma(-0.125, sqrt(Float64((x ^ -1.0) / y)), fma(-0.0390625, sqrt((Float64((x ^ 5.0) * y) ^ -1.0)), fma(0.5, sqrt(Float64(x / y)), Float64(0.0625 * sqrt((Float64((x ^ 3.0) * y) ^ -1.0)))))) / x)) * y) ^ -1.0;
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, 950.0], N[Power[N[(N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], N[Power[N[(N[(N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[Power[y, 7.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.0625 + N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[Power[y, 5.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.125 + N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.125 * N[Sqrt[N[(N[Power[x, -1.0], $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] + N[(-0.0390625 * N[Sqrt[N[Power[N[(N[Power[x, 5.0], $MachinePrecision] * y), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(x / y), $MachinePrecision]], $MachinePrecision] + N[(0.0625 * N[Sqrt[N[Power[N[(N[Power[x, 3.0], $MachinePrecision] * y), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], -1.0], $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 950:\\
\;\;\;\;{\left(\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{y} \cdot \sqrt{x}\right)}^{-1}\\

\mathbf{else}:\\
\;\;\;\;{\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \frac{\mathsf{fma}\left(-0.125, \sqrt{\frac{{x}^{-1}}{y}}, \mathsf{fma}\left(-0.0390625, \sqrt{{\left({x}^{5} \cdot y\right)}^{-1}}, \mathsf{fma}\left(0.5, \sqrt{\frac{x}{y}}, 0.0625 \cdot \sqrt{{\left({x}^{3} \cdot y\right)}^{-1}}\right)\right)\right)}{x}\right) \cdot y\right)}^{-1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 950

    1. Initial program 85.3%

      \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \color{blue}{\sqrt{x \cdot y}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{\color{blue}{x \cdot y}}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{\color{blue}{y \cdot x}}} \]
      4. sqrt-prodN/A

        \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \color{blue}{\sqrt{y} \cdot \sqrt{x}}} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \color{blue}{\sqrt{y} \cdot \sqrt{x}}} \]
      6. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \color{blue}{\sqrt{y}} \cdot \sqrt{x}} \]
      7. lower-sqrt.f6485.2

        \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{y} \cdot \color{blue}{\sqrt{x}}} \]
    4. Applied rewrites85.2%

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

    if 950 < x

    1. Initial program 85.3%

      \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \frac{1}{\color{blue}{y \cdot \left(\left(\sqrt{\frac{1 + x}{y}} + \left(\frac{-1}{8} \cdot \sqrt{\frac{1 + x}{{y}^{5}}} + \left(\frac{1}{16} \cdot \sqrt{\frac{1 + x}{{y}^{7}}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right)\right)\right) - \sqrt{\frac{x}{y}}\right)}} \]
    4. Applied rewrites36.5%

      \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + x}{y}} - \sqrt{\frac{x}{y}}\right)\right) \cdot y}} \]
    5. Taylor expanded in x around inf

      \[\leadsto \frac{1}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, \frac{1}{16}, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, \frac{-1}{8}, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot \frac{1}{2}\right)\right) + \frac{\frac{-1}{8} \cdot \sqrt{\frac{1}{x \cdot y}} + \left(\frac{-5}{128} \cdot \sqrt{\frac{1}{{x}^{5} \cdot y}} + \left(\frac{1}{16} \cdot \sqrt{\frac{1}{{x}^{3} \cdot y}} + \frac{1}{2} \cdot \sqrt{\frac{x}{y}}\right)\right)}{x}\right) \cdot y} \]
    6. Step-by-step derivation
      1. Applied rewrites48.2%

        \[\leadsto \frac{1}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \frac{\mathsf{fma}\left(-0.125, \sqrt{\frac{\frac{1}{x}}{y}}, \mathsf{fma}\left(-0.0390625, \sqrt{\frac{1}{{x}^{5} \cdot y}}, \mathsf{fma}\left(0.5, \sqrt{\frac{x}{y}}, 0.0625 \cdot \sqrt{\frac{1}{{x}^{3} \cdot y}}\right)\right)\right)}{x}\right) \cdot y} \]
    7. Recombined 2 regimes into one program.
    8. Final simplification48.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 950:\\ \;\;\;\;{\left(\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{y} \cdot \sqrt{x}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \frac{\mathsf{fma}\left(-0.125, \sqrt{\frac{{x}^{-1}}{y}}, \mathsf{fma}\left(-0.0390625, \sqrt{{\left({x}^{5} \cdot y\right)}^{-1}}, \mathsf{fma}\left(0.5, \sqrt{\frac{x}{y}}, 0.0625 \cdot \sqrt{{\left({x}^{3} \cdot y\right)}^{-1}}\right)\right)\right)}{x}\right) \cdot y\right)}^{-1}\\ \end{array} \]
    9. Add Preprocessing

    Alternative 2: 97.2% accurate, 0.1× speedup?

    \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 3100:\\ \;\;\;\;{\left(\sqrt{\frac{\mathsf{fma}\left(x, x, -1\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \frac{\mathsf{fma}\left(-0.125, \sqrt{\frac{{x}^{-1}}{y}}, \mathsf{fma}\left(0.5, \sqrt{\frac{x}{y}}, 0.0625 \cdot \sqrt{{\left({x}^{3} \cdot y\right)}^{-1}}\right)\right)}{x}\right) \cdot y\right)}^{-1}\\ \end{array} \end{array} \]
    NOTE: x and y should be sorted in increasing order before calling this function.
    (FPCore (x y)
     :precision binary64
     (if (<= x 3100.0)
       (pow
        (- (sqrt (/ (* (fma x x -1.0) (+ y 1.0)) (- x 1.0))) (sqrt (* x y)))
        -1.0)
       (pow
        (*
         (+
          (fma
           (sqrt (/ (+ 1.0 x) (pow y 7.0)))
           0.0625
           (fma
            (sqrt (/ (+ 1.0 x) (pow y 5.0)))
            -0.125
            (* (sqrt (/ (+ 1.0 x) (pow y 3.0))) 0.5)))
          (/
           (fma
            -0.125
            (sqrt (/ (pow x -1.0) y))
            (fma
             0.5
             (sqrt (/ x y))
             (* 0.0625 (sqrt (pow (* (pow x 3.0) y) -1.0)))))
           x))
         y)
        -1.0)))
    assert(x < y);
    double code(double x, double y) {
    	double tmp;
    	if (x <= 3100.0) {
    		tmp = pow((sqrt(((fma(x, x, -1.0) * (y + 1.0)) / (x - 1.0))) - sqrt((x * y))), -1.0);
    	} else {
    		tmp = pow(((fma(sqrt(((1.0 + x) / pow(y, 7.0))), 0.0625, fma(sqrt(((1.0 + x) / pow(y, 5.0))), -0.125, (sqrt(((1.0 + x) / pow(y, 3.0))) * 0.5))) + (fma(-0.125, sqrt((pow(x, -1.0) / y)), fma(0.5, sqrt((x / y)), (0.0625 * sqrt(pow((pow(x, 3.0) * y), -1.0))))) / x)) * y), -1.0);
    	}
    	return tmp;
    }
    
    x, y = sort([x, y])
    function code(x, y)
    	tmp = 0.0
    	if (x <= 3100.0)
    		tmp = Float64(sqrt(Float64(Float64(fma(x, x, -1.0) * Float64(y + 1.0)) / Float64(x - 1.0))) - sqrt(Float64(x * y))) ^ -1.0;
    	else
    		tmp = Float64(Float64(fma(sqrt(Float64(Float64(1.0 + x) / (y ^ 7.0))), 0.0625, fma(sqrt(Float64(Float64(1.0 + x) / (y ^ 5.0))), -0.125, Float64(sqrt(Float64(Float64(1.0 + x) / (y ^ 3.0))) * 0.5))) + Float64(fma(-0.125, sqrt(Float64((x ^ -1.0) / y)), fma(0.5, sqrt(Float64(x / y)), Float64(0.0625 * sqrt((Float64((x ^ 3.0) * y) ^ -1.0))))) / x)) * y) ^ -1.0;
    	end
    	return tmp
    end
    
    NOTE: x and y should be sorted in increasing order before calling this function.
    code[x_, y_] := If[LessEqual[x, 3100.0], N[Power[N[(N[Sqrt[N[(N[(N[(x * x + -1.0), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], N[Power[N[(N[(N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[Power[y, 7.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.0625 + N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[Power[y, 5.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.125 + N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.125 * N[Sqrt[N[(N[Power[x, -1.0], $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(x / y), $MachinePrecision]], $MachinePrecision] + N[(0.0625 * N[Sqrt[N[Power[N[(N[Power[x, 3.0], $MachinePrecision] * y), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], -1.0], $MachinePrecision]]
    
    \begin{array}{l}
    [x, y] = \mathsf{sort}([x, y])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 3100:\\
    \;\;\;\;{\left(\sqrt{\frac{\mathsf{fma}\left(x, x, -1\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}\right)}^{-1}\\
    
    \mathbf{else}:\\
    \;\;\;\;{\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \frac{\mathsf{fma}\left(-0.125, \sqrt{\frac{{x}^{-1}}{y}}, \mathsf{fma}\left(0.5, \sqrt{\frac{x}{y}}, 0.0625 \cdot \sqrt{{\left({x}^{3} \cdot y\right)}^{-1}}\right)\right)}{x}\right) \cdot y\right)}^{-1}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 3100

      1. Initial program 93.1%

        \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(x + 1\right) \cdot \left(y + 1\right)}} - \sqrt{x \cdot y}} \]
        2. lift-+.f64N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(x + 1\right)} \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        3. flip-+N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}} \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        4. associate-*l/N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{\left(x \cdot x - 1 \cdot 1\right) \cdot \left(y + 1\right)}{x - 1}}} - \sqrt{x \cdot y}} \]
        5. lower-/.f64N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{\left(x \cdot x - 1 \cdot 1\right) \cdot \left(y + 1\right)}{x - 1}}} - \sqrt{x \cdot y}} \]
        6. lower-*.f64N/A

          \[\leadsto \frac{1}{\sqrt{\frac{\color{blue}{\left(x \cdot x - 1 \cdot 1\right) \cdot \left(y + 1\right)}}{x - 1}} - \sqrt{x \cdot y}} \]
        7. metadata-evalN/A

          \[\leadsto \frac{1}{\sqrt{\frac{\left(x \cdot x - \color{blue}{1}\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}} \]
        8. sub-negN/A

          \[\leadsto \frac{1}{\sqrt{\frac{\color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}} \]
        9. metadata-evalN/A

          \[\leadsto \frac{1}{\sqrt{\frac{\left(x \cdot x + \color{blue}{-1}\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}} \]
        10. lower-fma.f64N/A

          \[\leadsto \frac{1}{\sqrt{\frac{\color{blue}{\mathsf{fma}\left(x, x, -1\right)} \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}} \]
        11. lower--.f6493.5

          \[\leadsto \frac{1}{\sqrt{\frac{\mathsf{fma}\left(x, x, -1\right) \cdot \left(y + 1\right)}{\color{blue}{x - 1}}} - \sqrt{x \cdot y}} \]
      4. Applied rewrites93.5%

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

      if 3100 < x

      1. Initial program 84.7%

        \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
      2. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \frac{1}{\color{blue}{y \cdot \left(\left(\sqrt{\frac{1 + x}{y}} + \left(\frac{-1}{8} \cdot \sqrt{\frac{1 + x}{{y}^{5}}} + \left(\frac{1}{16} \cdot \sqrt{\frac{1 + x}{{y}^{7}}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right)\right)\right) - \sqrt{\frac{x}{y}}\right)}} \]
      4. Applied rewrites36.6%

        \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + x}{y}} - \sqrt{\frac{x}{y}}\right)\right) \cdot y}} \]
      5. Taylor expanded in x around inf

        \[\leadsto \frac{1}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, \frac{1}{16}, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, \frac{-1}{8}, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot \frac{1}{2}\right)\right) + \frac{\frac{-1}{8} \cdot \sqrt{\frac{1}{x \cdot y}} + \left(\frac{1}{16} \cdot \sqrt{\frac{1}{{x}^{3} \cdot y}} + \frac{1}{2} \cdot \sqrt{\frac{x}{y}}\right)}{x}\right) \cdot y} \]
      6. Step-by-step derivation
        1. Applied rewrites47.3%

          \[\leadsto \frac{1}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \frac{\mathsf{fma}\left(-0.125, \sqrt{\frac{\frac{1}{x}}{y}}, \mathsf{fma}\left(0.5, \sqrt{\frac{x}{y}}, 0.0625 \cdot \sqrt{\frac{1}{{x}^{3} \cdot y}}\right)\right)}{x}\right) \cdot y} \]
      7. Recombined 2 regimes into one program.
      8. Final simplification50.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3100:\\ \;\;\;\;{\left(\sqrt{\frac{\mathsf{fma}\left(x, x, -1\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \frac{\mathsf{fma}\left(-0.125, \sqrt{\frac{{x}^{-1}}{y}}, \mathsf{fma}\left(0.5, \sqrt{\frac{x}{y}}, 0.0625 \cdot \sqrt{{\left({x}^{3} \cdot y\right)}^{-1}}\right)\right)}{x}\right) \cdot y\right)}^{-1}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 3: 96.9% accurate, 0.1× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 3100:\\ \;\;\;\;{\left(\sqrt{\frac{\mathsf{fma}\left(x, x, -1\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + y}{{x}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + y}{{x}^{5}}}, -0.125, \sqrt{\frac{1 + y}{{x}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + y}{x}} - \sqrt{\frac{y}{x}}\right)\right) \cdot x\right)}^{-1}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (if (<= x 3100.0)
         (pow
          (- (sqrt (/ (* (fma x x -1.0) (+ y 1.0)) (- x 1.0))) (sqrt (* x y)))
          -1.0)
         (pow
          (*
           (+
            (fma
             (sqrt (/ (+ 1.0 y) (pow x 7.0)))
             0.0625
             (fma
              (sqrt (/ (+ 1.0 y) (pow x 5.0)))
              -0.125
              (* (sqrt (/ (+ 1.0 y) (pow x 3.0))) 0.5)))
            (- (sqrt (/ (+ 1.0 y) x)) (sqrt (/ y x))))
           x)
          -1.0)))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (x <= 3100.0) {
      		tmp = pow((sqrt(((fma(x, x, -1.0) * (y + 1.0)) / (x - 1.0))) - sqrt((x * y))), -1.0);
      	} else {
      		tmp = pow(((fma(sqrt(((1.0 + y) / pow(x, 7.0))), 0.0625, fma(sqrt(((1.0 + y) / pow(x, 5.0))), -0.125, (sqrt(((1.0 + y) / pow(x, 3.0))) * 0.5))) + (sqrt(((1.0 + y) / x)) - sqrt((y / x)))) * x), -1.0);
      	}
      	return tmp;
      }
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (x <= 3100.0)
      		tmp = Float64(sqrt(Float64(Float64(fma(x, x, -1.0) * Float64(y + 1.0)) / Float64(x - 1.0))) - sqrt(Float64(x * y))) ^ -1.0;
      	else
      		tmp = Float64(Float64(fma(sqrt(Float64(Float64(1.0 + y) / (x ^ 7.0))), 0.0625, fma(sqrt(Float64(Float64(1.0 + y) / (x ^ 5.0))), -0.125, Float64(sqrt(Float64(Float64(1.0 + y) / (x ^ 3.0))) * 0.5))) + Float64(sqrt(Float64(Float64(1.0 + y) / x)) - sqrt(Float64(y / x)))) * x) ^ -1.0;
      	end
      	return tmp
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := If[LessEqual[x, 3100.0], N[Power[N[(N[Sqrt[N[(N[(N[(x * x + -1.0), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], N[Power[N[(N[(N[(N[Sqrt[N[(N[(1.0 + y), $MachinePrecision] / N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.0625 + N[(N[Sqrt[N[(N[(1.0 + y), $MachinePrecision] / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.125 + N[(N[Sqrt[N[(N[(1.0 + y), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(N[(1.0 + y), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], -1.0], $MachinePrecision]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq 3100:\\
      \;\;\;\;{\left(\sqrt{\frac{\mathsf{fma}\left(x, x, -1\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}\right)}^{-1}\\
      
      \mathbf{else}:\\
      \;\;\;\;{\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + y}{{x}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + y}{{x}^{5}}}, -0.125, \sqrt{\frac{1 + y}{{x}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + y}{x}} - \sqrt{\frac{y}{x}}\right)\right) \cdot x\right)}^{-1}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < 3100

        1. Initial program 93.1%

          \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(x + 1\right) \cdot \left(y + 1\right)}} - \sqrt{x \cdot y}} \]
          2. lift-+.f64N/A

            \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(x + 1\right)} \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
          3. flip-+N/A

            \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}} \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
          4. associate-*l/N/A

            \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{\left(x \cdot x - 1 \cdot 1\right) \cdot \left(y + 1\right)}{x - 1}}} - \sqrt{x \cdot y}} \]
          5. lower-/.f64N/A

            \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{\left(x \cdot x - 1 \cdot 1\right) \cdot \left(y + 1\right)}{x - 1}}} - \sqrt{x \cdot y}} \]
          6. lower-*.f64N/A

            \[\leadsto \frac{1}{\sqrt{\frac{\color{blue}{\left(x \cdot x - 1 \cdot 1\right) \cdot \left(y + 1\right)}}{x - 1}} - \sqrt{x \cdot y}} \]
          7. metadata-evalN/A

            \[\leadsto \frac{1}{\sqrt{\frac{\left(x \cdot x - \color{blue}{1}\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}} \]
          8. sub-negN/A

            \[\leadsto \frac{1}{\sqrt{\frac{\color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}} \]
          9. metadata-evalN/A

            \[\leadsto \frac{1}{\sqrt{\frac{\left(x \cdot x + \color{blue}{-1}\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}} \]
          10. lower-fma.f64N/A

            \[\leadsto \frac{1}{\sqrt{\frac{\color{blue}{\mathsf{fma}\left(x, x, -1\right)} \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}} \]
          11. lower--.f6493.5

            \[\leadsto \frac{1}{\sqrt{\frac{\mathsf{fma}\left(x, x, -1\right) \cdot \left(y + 1\right)}{\color{blue}{x - 1}}} - \sqrt{x \cdot y}} \]
        4. Applied rewrites93.5%

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

        if 3100 < x

        1. Initial program 84.7%

          \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        2. Add Preprocessing
        3. Taylor expanded in x around inf

          \[\leadsto \frac{1}{\color{blue}{x \cdot \left(\left(\sqrt{\frac{1 + y}{x}} + \left(\frac{-1}{8} \cdot \sqrt{\frac{1 + y}{{x}^{5}}} + \left(\frac{1}{16} \cdot \sqrt{\frac{1 + y}{{x}^{7}}} + \frac{1}{2} \cdot \sqrt{\frac{1 + y}{{x}^{3}}}\right)\right)\right) - \sqrt{\frac{y}{x}}\right)}} \]
        4. Applied rewrites96.2%

          \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + y}{{x}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + y}{{x}^{5}}}, -0.125, \sqrt{\frac{1 + y}{{x}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + y}{x}} - \sqrt{\frac{y}{x}}\right)\right) \cdot x}} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification96.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3100:\\ \;\;\;\;{\left(\sqrt{\frac{\mathsf{fma}\left(x, x, -1\right) \cdot \left(y + 1\right)}{x - 1}} - \sqrt{x \cdot y}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + y}{{x}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + y}{{x}^{5}}}, -0.125, \sqrt{\frac{1 + y}{{x}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + y}{x}} - \sqrt{\frac{y}{x}}\right)\right) \cdot x\right)}^{-1}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 4: 84.8% accurate, 0.1× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ {\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + x}{y}} - \sqrt{\frac{x}{y}}\right)\right) \cdot y\right)}^{-1} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (pow
        (*
         (+
          (fma
           (sqrt (/ (+ 1.0 x) (pow y 7.0)))
           0.0625
           (fma
            (sqrt (/ (+ 1.0 x) (pow y 5.0)))
            -0.125
            (* (sqrt (/ (+ 1.0 x) (pow y 3.0))) 0.5)))
          (- (sqrt (/ (+ 1.0 x) y)) (sqrt (/ x y))))
         y)
        -1.0))
      assert(x < y);
      double code(double x, double y) {
      	return pow(((fma(sqrt(((1.0 + x) / pow(y, 7.0))), 0.0625, fma(sqrt(((1.0 + x) / pow(y, 5.0))), -0.125, (sqrt(((1.0 + x) / pow(y, 3.0))) * 0.5))) + (sqrt(((1.0 + x) / y)) - sqrt((x / y)))) * y), -1.0);
      }
      
      x, y = sort([x, y])
      function code(x, y)
      	return Float64(Float64(fma(sqrt(Float64(Float64(1.0 + x) / (y ^ 7.0))), 0.0625, fma(sqrt(Float64(Float64(1.0 + x) / (y ^ 5.0))), -0.125, Float64(sqrt(Float64(Float64(1.0 + x) / (y ^ 3.0))) * 0.5))) + Float64(sqrt(Float64(Float64(1.0 + x) / y)) - sqrt(Float64(x / y)))) * y) ^ -1.0
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := N[Power[N[(N[(N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[Power[y, 7.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.0625 + N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[Power[y, 5.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.125 + N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], -1.0], $MachinePrecision]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      {\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + x}{y}} - \sqrt{\frac{x}{y}}\right)\right) \cdot y\right)}^{-1}
      \end{array}
      
      Derivation
      1. Initial program 85.3%

        \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
      2. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \frac{1}{\color{blue}{y \cdot \left(\left(\sqrt{\frac{1 + x}{y}} + \left(\frac{-1}{8} \cdot \sqrt{\frac{1 + x}{{y}^{5}}} + \left(\frac{1}{16} \cdot \sqrt{\frac{1 + x}{{y}^{7}}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right)\right)\right) - \sqrt{\frac{x}{y}}\right)}} \]
      4. Applied rewrites36.5%

        \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + x}{y}} - \sqrt{\frac{x}{y}}\right)\right) \cdot y}} \]
      5. Final simplification36.5%

        \[\leadsto {\left(\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{7}}}, 0.0625, \mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{5}}}, -0.125, \sqrt{\frac{1 + x}{{y}^{3}}} \cdot 0.5\right)\right) + \left(\sqrt{\frac{1 + x}{y}} - \sqrt{\frac{x}{y}}\right)\right) \cdot y\right)}^{-1} \]
      6. Add Preprocessing

      Alternative 5: 84.5% accurate, 0.4× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ {\left(\sqrt{\left(\left(x + 1\right) + y\right) + y \cdot x} - \sqrt{x \cdot y}\right)}^{-1} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (pow (- (sqrt (+ (+ (+ x 1.0) y) (* y x))) (sqrt (* x y))) -1.0))
      assert(x < y);
      double code(double x, double y) {
      	return pow((sqrt((((x + 1.0) + y) + (y * x))) - sqrt((x * y))), -1.0);
      }
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          code = (sqrt((((x + 1.0d0) + y) + (y * x))) - sqrt((x * y))) ** (-1.0d0)
      end function
      
      assert x < y;
      public static double code(double x, double y) {
      	return Math.pow((Math.sqrt((((x + 1.0) + y) + (y * x))) - Math.sqrt((x * y))), -1.0);
      }
      
      [x, y] = sort([x, y])
      def code(x, y):
      	return math.pow((math.sqrt((((x + 1.0) + y) + (y * x))) - math.sqrt((x * y))), -1.0)
      
      x, y = sort([x, y])
      function code(x, y)
      	return Float64(sqrt(Float64(Float64(Float64(x + 1.0) + y) + Float64(y * x))) - sqrt(Float64(x * y))) ^ -1.0
      end
      
      x, y = num2cell(sort([x, y])){:}
      function tmp = code(x, y)
      	tmp = (sqrt((((x + 1.0) + y) + (y * x))) - sqrt((x * y))) ^ -1.0;
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := N[Power[N[(N[Sqrt[N[(N[(N[(x + 1.0), $MachinePrecision] + y), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      {\left(\sqrt{\left(\left(x + 1\right) + y\right) + y \cdot x} - \sqrt{x \cdot y}\right)}^{-1}
      \end{array}
      
      Derivation
      1. Initial program 85.3%

        \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(x + 1\right) \cdot \left(y + 1\right)}} - \sqrt{x \cdot y}} \]
        2. *-commutativeN/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(y + 1\right) \cdot \left(x + 1\right)}} - \sqrt{x \cdot y}} \]
        3. lift-+.f64N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(y + 1\right)} \cdot \left(x + 1\right)} - \sqrt{x \cdot y}} \]
        4. distribute-rgt1-inN/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(x + 1\right) + y \cdot \left(x + 1\right)}} - \sqrt{x \cdot y}} \]
        5. *-commutativeN/A

          \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) + \color{blue}{\left(x + 1\right) \cdot y}} - \sqrt{x \cdot y}} \]
        6. lift-+.f64N/A

          \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) + \color{blue}{\left(x + 1\right)} \cdot y} - \sqrt{x \cdot y}} \]
        7. distribute-rgt1-inN/A

          \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) + \color{blue}{\left(y + x \cdot y\right)}} - \sqrt{x \cdot y}} \]
        8. lift-*.f64N/A

          \[\leadsto \frac{1}{\sqrt{\left(x + 1\right) + \left(y + \color{blue}{x \cdot y}\right)} - \sqrt{x \cdot y}} \]
        9. associate-+r+N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(\left(x + 1\right) + y\right) + x \cdot y}} - \sqrt{x \cdot y}} \]
        10. lower-+.f64N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(\left(x + 1\right) + y\right) + x \cdot y}} - \sqrt{x \cdot y}} \]
        11. lower-+.f6485.4

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(\left(x + 1\right) + y\right)} + x \cdot y} - \sqrt{x \cdot y}} \]
        12. lift-*.f64N/A

          \[\leadsto \frac{1}{\sqrt{\left(\left(x + 1\right) + y\right) + \color{blue}{x \cdot y}} - \sqrt{x \cdot y}} \]
        13. *-commutativeN/A

          \[\leadsto \frac{1}{\sqrt{\left(\left(x + 1\right) + y\right) + \color{blue}{y \cdot x}} - \sqrt{x \cdot y}} \]
        14. lower-*.f6485.4

          \[\leadsto \frac{1}{\sqrt{\left(\left(x + 1\right) + y\right) + \color{blue}{y \cdot x}} - \sqrt{x \cdot y}} \]
      4. Applied rewrites85.4%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(\left(x + 1\right) + y\right) + y \cdot x}} - \sqrt{x \cdot y}} \]
      5. Final simplification85.4%

        \[\leadsto {\left(\sqrt{\left(\left(x + 1\right) + y\right) + y \cdot x} - \sqrt{x \cdot y}\right)}^{-1} \]
      6. Add Preprocessing

      Alternative 6: 82.5% accurate, 0.4× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \sqrt{x \cdot y}\\ \mathbf{if}\;x \leq 0.000215:\\ \;\;\;\;{\left(\sqrt{1 + y} - t\_0\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\mathsf{fma}\left(y, x, y\right)} - t\_0\right)}^{-1}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (let* ((t_0 (sqrt (* x y))))
         (if (<= x 0.000215)
           (pow (- (sqrt (+ 1.0 y)) t_0) -1.0)
           (pow (- (sqrt (fma y x y)) t_0) -1.0))))
      assert(x < y);
      double code(double x, double y) {
      	double t_0 = sqrt((x * y));
      	double tmp;
      	if (x <= 0.000215) {
      		tmp = pow((sqrt((1.0 + y)) - t_0), -1.0);
      	} else {
      		tmp = pow((sqrt(fma(y, x, y)) - t_0), -1.0);
      	}
      	return tmp;
      }
      
      x, y = sort([x, y])
      function code(x, y)
      	t_0 = sqrt(Float64(x * y))
      	tmp = 0.0
      	if (x <= 0.000215)
      		tmp = Float64(sqrt(Float64(1.0 + y)) - t_0) ^ -1.0;
      	else
      		tmp = Float64(sqrt(fma(y, x, y)) - t_0) ^ -1.0;
      	end
      	return tmp
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := Block[{t$95$0 = N[Sqrt[N[(x * y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 0.000215], N[Power[N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], -1.0], $MachinePrecision], N[Power[N[(N[Sqrt[N[(y * x + y), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], -1.0], $MachinePrecision]]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      t_0 := \sqrt{x \cdot y}\\
      \mathbf{if}\;x \leq 0.000215:\\
      \;\;\;\;{\left(\sqrt{1 + y} - t\_0\right)}^{-1}\\
      
      \mathbf{else}:\\
      \;\;\;\;{\left(\sqrt{\mathsf{fma}\left(y, x, y\right)} - t\_0\right)}^{-1}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < 2.14999999999999995e-4

        1. Initial program 85.3%

          \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + y}} - \sqrt{x \cdot y}} \]
        4. Step-by-step derivation
          1. lower-+.f648.0

            \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + y}} - \sqrt{x \cdot y}} \]
        5. Applied rewrites8.0%

          \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + y}} - \sqrt{x \cdot y}} \]

        if 2.14999999999999995e-4 < x

        1. Initial program 85.3%

          \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        2. Add Preprocessing
        3. Taylor expanded in y around inf

          \[\leadsto \frac{1}{\sqrt{\color{blue}{y \cdot \left(1 + x\right)}} - \sqrt{x \cdot y}} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \frac{1}{\sqrt{y \cdot \color{blue}{\left(x + 1\right)}} - \sqrt{x \cdot y}} \]
          2. distribute-lft-inN/A

            \[\leadsto \frac{1}{\sqrt{\color{blue}{y \cdot x + y \cdot 1}} - \sqrt{x \cdot y}} \]
          3. *-rgt-identityN/A

            \[\leadsto \frac{1}{\sqrt{y \cdot x + \color{blue}{y}} - \sqrt{x \cdot y}} \]
          4. lower-fma.f6437.3

            \[\leadsto \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(y, x, y\right)}} - \sqrt{x \cdot y}} \]
        5. Applied rewrites37.3%

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(y, x, y\right)}} - \sqrt{x \cdot y}} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification37.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.000215:\\ \;\;\;\;{\left(\sqrt{1 + y} - \sqrt{x \cdot y}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\mathsf{fma}\left(y, x, y\right)} - \sqrt{x \cdot y}\right)}^{-1}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 7: 84.5% accurate, 0.4× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ {\left(\sqrt{\mathsf{fma}\left(y, x, x\right) + \left(y + 1\right)} - \sqrt{x \cdot y}\right)}^{-1} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (pow (- (sqrt (+ (fma y x x) (+ y 1.0))) (sqrt (* x y))) -1.0))
      assert(x < y);
      double code(double x, double y) {
      	return pow((sqrt((fma(y, x, x) + (y + 1.0))) - sqrt((x * y))), -1.0);
      }
      
      x, y = sort([x, y])
      function code(x, y)
      	return Float64(sqrt(Float64(fma(y, x, x) + Float64(y + 1.0))) - sqrt(Float64(x * y))) ^ -1.0
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := N[Power[N[(N[Sqrt[N[(N[(y * x + x), $MachinePrecision] + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      {\left(\sqrt{\mathsf{fma}\left(y, x, x\right) + \left(y + 1\right)} - \sqrt{x \cdot y}\right)}^{-1}
      \end{array}
      
      Derivation
      1. Initial program 85.3%

        \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(x + 1\right) \cdot \left(y + 1\right)}} - \sqrt{x \cdot y}} \]
        2. *-commutativeN/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(y + 1\right) \cdot \left(x + 1\right)}} - \sqrt{x \cdot y}} \]
        3. lift-+.f64N/A

          \[\leadsto \frac{1}{\sqrt{\left(y + 1\right) \cdot \color{blue}{\left(x + 1\right)}} - \sqrt{x \cdot y}} \]
        4. distribute-lft-inN/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(y + 1\right) \cdot x + \left(y + 1\right) \cdot 1}} - \sqrt{x \cdot y}} \]
        5. *-rgt-identityN/A

          \[\leadsto \frac{1}{\sqrt{\left(y + 1\right) \cdot x + \color{blue}{\left(y + 1\right)}} - \sqrt{x \cdot y}} \]
        6. lower-+.f64N/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(y + 1\right) \cdot x + \left(y + 1\right)}} - \sqrt{x \cdot y}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{x \cdot \left(y + 1\right)} + \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        8. lift-+.f64N/A

          \[\leadsto \frac{1}{\sqrt{x \cdot \color{blue}{\left(y + 1\right)} + \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        9. distribute-lft-inN/A

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\left(x \cdot y + x \cdot 1\right)} + \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        10. *-rgt-identityN/A

          \[\leadsto \frac{1}{\sqrt{\left(x \cdot y + \color{blue}{x}\right) + \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        11. *-commutativeN/A

          \[\leadsto \frac{1}{\sqrt{\left(\color{blue}{y \cdot x} + x\right) + \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        12. lower-fma.f6485.4

          \[\leadsto \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(y, x, x\right)} + \left(y + 1\right)} - \sqrt{x \cdot y}} \]
      4. Applied rewrites85.4%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(y, x, x\right) + \left(y + 1\right)}} - \sqrt{x \cdot y}} \]
      5. Final simplification85.4%

        \[\leadsto {\left(\sqrt{\mathsf{fma}\left(y, x, x\right) + \left(y + 1\right)} - \sqrt{x \cdot y}\right)}^{-1} \]
      6. Add Preprocessing

      Alternative 8: 84.4% accurate, 0.4× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ {\left(\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}\right)}^{-1} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (pow (- (sqrt (* (+ x 1.0) (+ y 1.0))) (sqrt (* x y))) -1.0))
      assert(x < y);
      double code(double x, double y) {
      	return pow((sqrt(((x + 1.0) * (y + 1.0))) - sqrt((x * y))), -1.0);
      }
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          code = (sqrt(((x + 1.0d0) * (y + 1.0d0))) - sqrt((x * y))) ** (-1.0d0)
      end function
      
      assert x < y;
      public static double code(double x, double y) {
      	return Math.pow((Math.sqrt(((x + 1.0) * (y + 1.0))) - Math.sqrt((x * y))), -1.0);
      }
      
      [x, y] = sort([x, y])
      def code(x, y):
      	return math.pow((math.sqrt(((x + 1.0) * (y + 1.0))) - math.sqrt((x * y))), -1.0)
      
      x, y = sort([x, y])
      function code(x, y)
      	return Float64(sqrt(Float64(Float64(x + 1.0) * Float64(y + 1.0))) - sqrt(Float64(x * y))) ^ -1.0
      end
      
      x, y = num2cell(sort([x, y])){:}
      function tmp = code(x, y)
      	tmp = (sqrt(((x + 1.0) * (y + 1.0))) - sqrt((x * y))) ^ -1.0;
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := N[Power[N[(N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      {\left(\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}\right)}^{-1}
      \end{array}
      
      Derivation
      1. Initial program 85.3%

        \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
      2. Add Preprocessing
      3. Final simplification85.3%

        \[\leadsto {\left(\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}\right)}^{-1} \]
      4. Add Preprocessing

      Alternative 9: 51.8% accurate, 0.4× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;{\left(\sqrt{1 + y} - \sqrt{x \cdot y}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(0.5 \cdot \sqrt{\frac{1 + x}{y}}\right)}^{-1}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (if (<= x 1.0)
         (pow (- (sqrt (+ 1.0 y)) (sqrt (* x y))) -1.0)
         (pow (* 0.5 (sqrt (/ (+ 1.0 x) y))) -1.0)))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (x <= 1.0) {
      		tmp = pow((sqrt((1.0 + y)) - sqrt((x * y))), -1.0);
      	} else {
      		tmp = pow((0.5 * sqrt(((1.0 + x) / y))), -1.0);
      	}
      	return tmp;
      }
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: tmp
          if (x <= 1.0d0) then
              tmp = (sqrt((1.0d0 + y)) - sqrt((x * y))) ** (-1.0d0)
          else
              tmp = (0.5d0 * sqrt(((1.0d0 + x) / y))) ** (-1.0d0)
          end if
          code = tmp
      end function
      
      assert x < y;
      public static double code(double x, double y) {
      	double tmp;
      	if (x <= 1.0) {
      		tmp = Math.pow((Math.sqrt((1.0 + y)) - Math.sqrt((x * y))), -1.0);
      	} else {
      		tmp = Math.pow((0.5 * Math.sqrt(((1.0 + x) / y))), -1.0);
      	}
      	return tmp;
      }
      
      [x, y] = sort([x, y])
      def code(x, y):
      	tmp = 0
      	if x <= 1.0:
      		tmp = math.pow((math.sqrt((1.0 + y)) - math.sqrt((x * y))), -1.0)
      	else:
      		tmp = math.pow((0.5 * math.sqrt(((1.0 + x) / y))), -1.0)
      	return tmp
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (x <= 1.0)
      		tmp = Float64(sqrt(Float64(1.0 + y)) - sqrt(Float64(x * y))) ^ -1.0;
      	else
      		tmp = Float64(0.5 * sqrt(Float64(Float64(1.0 + x) / y))) ^ -1.0;
      	end
      	return tmp
      end
      
      x, y = num2cell(sort([x, y])){:}
      function tmp_2 = code(x, y)
      	tmp = 0.0;
      	if (x <= 1.0)
      		tmp = (sqrt((1.0 + y)) - sqrt((x * y))) ^ -1.0;
      	else
      		tmp = (0.5 * sqrt(((1.0 + x) / y))) ^ -1.0;
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := If[LessEqual[x, 1.0], N[Power[N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], N[Power[N[(0.5 * N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq 1:\\
      \;\;\;\;{\left(\sqrt{1 + y} - \sqrt{x \cdot y}\right)}^{-1}\\
      
      \mathbf{else}:\\
      \;\;\;\;{\left(0.5 \cdot \sqrt{\frac{1 + x}{y}}\right)}^{-1}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < 1

        1. Initial program 85.3%

          \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + y}} - \sqrt{x \cdot y}} \]
        4. Step-by-step derivation
          1. lower-+.f648.0

            \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + y}} - \sqrt{x \cdot y}} \]
        5. Applied rewrites8.0%

          \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + y}} - \sqrt{x \cdot y}} \]

        if 1 < x

        1. Initial program 85.3%

          \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        2. Add Preprocessing
        3. Taylor expanded in y around inf

          \[\leadsto \frac{1}{\color{blue}{y \cdot \left(\left(\sqrt{\frac{1 + x}{y}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right) - \sqrt{\frac{x}{y}}\right)}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \frac{1}{\color{blue}{\left(\left(\sqrt{\frac{1 + x}{y}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right) - \sqrt{\frac{x}{y}}\right) \cdot y}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{1}{\color{blue}{\left(\left(\sqrt{\frac{1 + x}{y}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right) - \sqrt{\frac{x}{y}}\right) \cdot y}} \]
        5. Applied rewrites38.1%

          \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{3}}}, 0.5, \sqrt{\frac{1 + x}{y}}\right) - \sqrt{\frac{x}{y}}\right) \cdot y}} \]
        6. Taylor expanded in y around 0

          \[\leadsto \frac{1}{\frac{1}{2} \cdot \color{blue}{\sqrt{\frac{1 + x}{y}}}} \]
        7. Step-by-step derivation
          1. Applied rewrites6.3%

            \[\leadsto \frac{1}{0.5 \cdot \color{blue}{\sqrt{\frac{1 + x}{y}}}} \]
        8. Recombined 2 regimes into one program.
        9. Final simplification6.3%

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;{\left(\sqrt{1 + y} - \sqrt{x \cdot y}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(0.5 \cdot \sqrt{\frac{1 + x}{y}}\right)}^{-1}\\ \end{array} \]
        10. Add Preprocessing

        Alternative 10: 8.8% accurate, 0.4× speedup?

        \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ {\left(0.5 \cdot \sqrt{\frac{1 + x}{y}}\right)}^{-1} \end{array} \]
        NOTE: x and y should be sorted in increasing order before calling this function.
        (FPCore (x y) :precision binary64 (pow (* 0.5 (sqrt (/ (+ 1.0 x) y))) -1.0))
        assert(x < y);
        double code(double x, double y) {
        	return pow((0.5 * sqrt(((1.0 + x) / y))), -1.0);
        }
        
        NOTE: x and y should be sorted in increasing order before calling this function.
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = (0.5d0 * sqrt(((1.0d0 + x) / y))) ** (-1.0d0)
        end function
        
        assert x < y;
        public static double code(double x, double y) {
        	return Math.pow((0.5 * Math.sqrt(((1.0 + x) / y))), -1.0);
        }
        
        [x, y] = sort([x, y])
        def code(x, y):
        	return math.pow((0.5 * math.sqrt(((1.0 + x) / y))), -1.0)
        
        x, y = sort([x, y])
        function code(x, y)
        	return Float64(0.5 * sqrt(Float64(Float64(1.0 + x) / y))) ^ -1.0
        end
        
        x, y = num2cell(sort([x, y])){:}
        function tmp = code(x, y)
        	tmp = (0.5 * sqrt(((1.0 + x) / y))) ^ -1.0;
        end
        
        NOTE: x and y should be sorted in increasing order before calling this function.
        code[x_, y_] := N[Power[N[(0.5 * N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]
        
        \begin{array}{l}
        [x, y] = \mathsf{sort}([x, y])\\
        \\
        {\left(0.5 \cdot \sqrt{\frac{1 + x}{y}}\right)}^{-1}
        \end{array}
        
        Derivation
        1. Initial program 85.3%

          \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
        2. Add Preprocessing
        3. Taylor expanded in y around inf

          \[\leadsto \frac{1}{\color{blue}{y \cdot \left(\left(\sqrt{\frac{1 + x}{y}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right) - \sqrt{\frac{x}{y}}\right)}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \frac{1}{\color{blue}{\left(\left(\sqrt{\frac{1 + x}{y}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right) - \sqrt{\frac{x}{y}}\right) \cdot y}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{1}{\color{blue}{\left(\left(\sqrt{\frac{1 + x}{y}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right) - \sqrt{\frac{x}{y}}\right) \cdot y}} \]
        5. Applied rewrites38.1%

          \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{3}}}, 0.5, \sqrt{\frac{1 + x}{y}}\right) - \sqrt{\frac{x}{y}}\right) \cdot y}} \]
        6. Taylor expanded in y around 0

          \[\leadsto \frac{1}{\frac{1}{2} \cdot \color{blue}{\sqrt{\frac{1 + x}{y}}}} \]
        7. Step-by-step derivation
          1. Applied rewrites6.3%

            \[\leadsto \frac{1}{0.5 \cdot \color{blue}{\sqrt{\frac{1 + x}{y}}}} \]
          2. Final simplification6.3%

            \[\leadsto {\left(0.5 \cdot \sqrt{\frac{1 + x}{y}}\right)}^{-1} \]
          3. Add Preprocessing

          Alternative 11: 6.1% accurate, 0.4× speedup?

          \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ {\left(0.5 \cdot \sqrt{\frac{x}{y}}\right)}^{-1} \end{array} \]
          NOTE: x and y should be sorted in increasing order before calling this function.
          (FPCore (x y) :precision binary64 (pow (* 0.5 (sqrt (/ x y))) -1.0))
          assert(x < y);
          double code(double x, double y) {
          	return pow((0.5 * sqrt((x / y))), -1.0);
          }
          
          NOTE: x and y should be sorted in increasing order before calling this function.
          real(8) function code(x, y)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              code = (0.5d0 * sqrt((x / y))) ** (-1.0d0)
          end function
          
          assert x < y;
          public static double code(double x, double y) {
          	return Math.pow((0.5 * Math.sqrt((x / y))), -1.0);
          }
          
          [x, y] = sort([x, y])
          def code(x, y):
          	return math.pow((0.5 * math.sqrt((x / y))), -1.0)
          
          x, y = sort([x, y])
          function code(x, y)
          	return Float64(0.5 * sqrt(Float64(x / y))) ^ -1.0
          end
          
          x, y = num2cell(sort([x, y])){:}
          function tmp = code(x, y)
          	tmp = (0.5 * sqrt((x / y))) ^ -1.0;
          end
          
          NOTE: x and y should be sorted in increasing order before calling this function.
          code[x_, y_] := N[Power[N[(0.5 * N[Sqrt[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]
          
          \begin{array}{l}
          [x, y] = \mathsf{sort}([x, y])\\
          \\
          {\left(0.5 \cdot \sqrt{\frac{x}{y}}\right)}^{-1}
          \end{array}
          
          Derivation
          1. Initial program 85.3%

            \[\frac{1}{\sqrt{\left(x + 1\right) \cdot \left(y + 1\right)} - \sqrt{x \cdot y}} \]
          2. Add Preprocessing
          3. Taylor expanded in y around inf

            \[\leadsto \frac{1}{\color{blue}{y \cdot \left(\left(\sqrt{\frac{1 + x}{y}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right) - \sqrt{\frac{x}{y}}\right)}} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \frac{1}{\color{blue}{\left(\left(\sqrt{\frac{1 + x}{y}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right) - \sqrt{\frac{x}{y}}\right) \cdot y}} \]
            2. lower-*.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\left(\left(\sqrt{\frac{1 + x}{y}} + \frac{1}{2} \cdot \sqrt{\frac{1 + x}{{y}^{3}}}\right) - \sqrt{\frac{x}{y}}\right) \cdot y}} \]
          5. Applied rewrites38.1%

            \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{fma}\left(\sqrt{\frac{1 + x}{{y}^{3}}}, 0.5, \sqrt{\frac{1 + x}{y}}\right) - \sqrt{\frac{x}{y}}\right) \cdot y}} \]
          6. Taylor expanded in x around inf

            \[\leadsto \frac{1}{\frac{1}{2} \cdot \color{blue}{\sqrt{\frac{x}{y}}}} \]
          7. Step-by-step derivation
            1. Applied rewrites6.2%

              \[\leadsto \frac{1}{0.5 \cdot \color{blue}{\sqrt{\frac{x}{y}}}} \]
            2. Final simplification6.2%

              \[\leadsto {\left(0.5 \cdot \sqrt{\frac{x}{y}}\right)}^{-1} \]
            3. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 1 
            (FPCore (x y)
              :name "1/(sqrt((x + 1) * (y + 1)) - sqrt(x * y))"
              :precision binary64
              :pre (and (and (<= 1000.0 x) (<= x 1000000000.0)) (and (<= 0.0 y) (<= y 1.79e+308)))
              (/ 1.0 (- (sqrt (* (+ x 1.0) (+ y 1.0))) (sqrt (* x y)))))