2isqrt (example 3.6)

Percentage Accurate: 38.0% → 99.9%
Time: 14.6s
Alternatives: 5
Speedup: 2.0×

Specification

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

\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\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 5 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: 38.0% accurate, 1.0× speedup?

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

\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}

Alternative 1: 99.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 0:\\ \;\;\;\;{x}^{-1.5} \cdot \left(0.5 + \frac{0.5}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{1 + x} \cdot \frac{1}{x}}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 0.0)
   (* (pow x -1.5) (+ 0.5 (/ 0.5 x)))
   (/
    1.0
    (/
     (+ (pow x -0.5) (pow (+ 1.0 x) -0.5))
     (* (/ 1.0 (+ 1.0 x)) (/ 1.0 x))))))
double code(double x) {
	double tmp;
	if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 0.0) {
		tmp = pow(x, -1.5) * (0.5 + (0.5 / x));
	} else {
		tmp = 1.0 / ((pow(x, -0.5) + pow((1.0 + x), -0.5)) / ((1.0 / (1.0 + x)) * (1.0 / x)));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((1.0d0 + x)))) <= 0.0d0) then
        tmp = (x ** (-1.5d0)) * (0.5d0 + (0.5d0 / x))
    else
        tmp = 1.0d0 / (((x ** (-0.5d0)) + ((1.0d0 + x) ** (-0.5d0))) / ((1.0d0 / (1.0d0 + x)) * (1.0d0 / x)))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (((1.0 / Math.sqrt(x)) + (-1.0 / Math.sqrt((1.0 + x)))) <= 0.0) {
		tmp = Math.pow(x, -1.5) * (0.5 + (0.5 / x));
	} else {
		tmp = 1.0 / ((Math.pow(x, -0.5) + Math.pow((1.0 + x), -0.5)) / ((1.0 / (1.0 + x)) * (1.0 / x)));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 0.0:
		tmp = math.pow(x, -1.5) * (0.5 + (0.5 / x))
	else:
		tmp = 1.0 / ((math.pow(x, -0.5) + math.pow((1.0 + x), -0.5)) / ((1.0 / (1.0 + x)) * (1.0 / x)))
	return tmp
function code(x)
	tmp = 0.0
	if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 0.0)
		tmp = Float64((x ^ -1.5) * Float64(0.5 + Float64(0.5 / x)));
	else
		tmp = Float64(1.0 / Float64(Float64((x ^ -0.5) + (Float64(1.0 + x) ^ -0.5)) / Float64(Float64(1.0 / Float64(1.0 + x)) * Float64(1.0 / x))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 0.0)
		tmp = (x ^ -1.5) * (0.5 + (0.5 / x));
	else
		tmp = 1.0 / (((x ^ -0.5) + ((1.0 + x) ^ -0.5)) / ((1.0 / (1.0 + x)) * (1.0 / x)));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[Power[x, -1.5], $MachinePrecision] * N[(0.5 + N[(0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 0:\\
\;\;\;\;{x}^{-1.5} \cdot \left(0.5 + \frac{0.5}{x}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{1 + x} \cdot \frac{1}{x}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 x)) (/.f64 #s(literal 1 binary64) (sqrt.f64 (+.f64 x #s(literal 1 binary64))))) < 0.0

    1. Initial program 42.9%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 82.9%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \sqrt{\frac{1}{x}} - -0.5 \cdot \sqrt{x}}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. div-sub82.9%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \sqrt{\frac{1}{x}}}{{x}^{2}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}}} \]
      2. *-commutative82.9%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot -0.5}}{{x}^{2}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}} \]
      3. associate-/l*82.9%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}} \]
      4. *-commutative82.9%

        \[\leadsto \sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}} - \frac{\color{blue}{\sqrt{x} \cdot -0.5}}{{x}^{2}} \]
      5. associate-/l*82.9%

        \[\leadsto \sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}} - \color{blue}{\sqrt{x} \cdot \frac{-0.5}{{x}^{2}}} \]
      6. distribute-rgt-out--82.9%

        \[\leadsto \color{blue}{\frac{-0.5}{{x}^{2}} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)} \]
    5. Simplified82.9%

      \[\leadsto \color{blue}{\frac{-0.5}{{x}^{2}} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)} \]
    6. Taylor expanded in x around -inf 0.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{0.5 \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{x}} \]
    7. Step-by-step derivation
      1. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(0.5 \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)}{x}} \]
    8. Simplified99.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot 0.5}{x}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity99.7%

        \[\leadsto \color{blue}{1 \cdot \frac{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot 0.5}{x}} \]
      2. distribute-rgt-out99.7%

        \[\leadsto 1 \cdot \frac{\color{blue}{0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{x}}\right)}}{x} \]
      3. associate-/l*99.7%

        \[\leadsto 1 \cdot \color{blue}{\left(0.5 \cdot \frac{\sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{x}}}{x}\right)} \]
      4. pow-flip99.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{\sqrt{\color{blue}{{x}^{\left(-3\right)}}} + \sqrt{\frac{1}{x}}}{x}\right) \]
      5. sqrt-pow199.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{\color{blue}{{x}^{\left(\frac{-3}{2}\right)}} + \sqrt{\frac{1}{x}}}{x}\right) \]
      6. metadata-eval99.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{\left(\frac{\color{blue}{-3}}{2}\right)} + \sqrt{\frac{1}{x}}}{x}\right) \]
      7. metadata-eval99.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{\color{blue}{-1.5}} + \sqrt{\frac{1}{x}}}{x}\right) \]
      8. inv-pow99.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + \sqrt{\color{blue}{{x}^{-1}}}}{x}\right) \]
      9. sqrt-pow199.8%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + \color{blue}{{x}^{\left(\frac{-1}{2}\right)}}}{x}\right) \]
      10. metadata-eval99.8%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + {x}^{\color{blue}{-0.5}}}{x}\right) \]
    10. Applied egg-rr99.8%

      \[\leadsto \color{blue}{1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}\right)} \]
    11. Step-by-step derivation
      1. *-lft-identity99.8%

        \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}} \]
    12. Simplified99.8%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}} \]
    13. Step-by-step derivation
      1. associate-*r/99.8%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left({x}^{-1.5} + {x}^{-0.5}\right)}{x}} \]
      2. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \left({x}^{-1.5} + {x}^{-0.5}\right)} \]
      3. distribute-rgt-in99.7%

        \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{0.5}{x} + {x}^{-0.5} \cdot \frac{0.5}{x}} \]
      4. *-commutative99.7%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{\frac{0.5}{x} \cdot {x}^{-0.5}} \]
      5. div-inv99.7%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{\left(0.5 \cdot \frac{1}{x}\right)} \cdot {x}^{-0.5} \]
      6. associate-*l*99.7%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{0.5 \cdot \left(\frac{1}{x} \cdot {x}^{-0.5}\right)} \]
      7. inv-pow99.7%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \left(\color{blue}{{x}^{-1}} \cdot {x}^{-0.5}\right) \]
      8. metadata-eval99.7%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \left({x}^{\color{blue}{\left(-0.5 + -0.5\right)}} \cdot {x}^{-0.5}\right) \]
      9. pow-prod-up99.3%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \left(\color{blue}{\left({x}^{-0.5} \cdot {x}^{-0.5}\right)} \cdot {x}^{-0.5}\right) \]
      10. unpow399.3%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \color{blue}{{\left({x}^{-0.5}\right)}^{3}} \]
      11. pow-pow100.0%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \color{blue}{{x}^{\left(-0.5 \cdot 3\right)}} \]
      12. metadata-eval100.0%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot {x}^{\color{blue}{-1.5}} \]
    14. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot {x}^{-1.5}} \]
    15. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{{x}^{-1.5} \cdot 0.5} \]
      2. distribute-lft-out100.0%

        \[\leadsto \color{blue}{{x}^{-1.5} \cdot \left(\frac{0.5}{x} + 0.5\right)} \]
    16. Simplified100.0%

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot \left(\frac{0.5}{x} + 0.5\right)} \]

    if 0.0 < (-.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 x)) (/.f64 #s(literal 1 binary64) (sqrt.f64 (+.f64 x #s(literal 1 binary64)))))

    1. Initial program 56.1%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--55.2%

        \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
      2. clear-num55.2%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}}} \]
      3. inv-pow55.2%

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

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

        \[\leadsto \frac{1}{\frac{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      6. inv-pow55.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + \color{blue}{{\left(\sqrt{x + 1}\right)}^{-1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      7. sqrt-pow255.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(\frac{-1}{2}\right)}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      8. +-commutative55.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\color{blue}{\left(1 + x\right)}}^{\left(\frac{-1}{2}\right)}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      9. metadata-eval55.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{\color{blue}{-0.5}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      10. frac-times56.3%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{1 \cdot 1}{\sqrt{x} \cdot \sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      11. metadata-eval56.3%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      12. add-sqr-sqrt55.9%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{\color{blue}{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      13. frac-times56.9%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}}} \]
      14. metadata-eval56.9%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}} \]
      15. add-sqr-sqrt57.9%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{1}{\color{blue}{x + 1}}}} \]
      16. +-commutative57.9%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}} \]
    4. Applied egg-rr57.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{1}{1 + x}}}} \]
    5. Step-by-step derivation
      1. frac-sub93.0%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{1 \cdot \left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}} \]
      2. *-un-lft-identity93.0%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{\color{blue}{\left(1 + x\right)} - x \cdot 1}{x \cdot \left(1 + x\right)}}} \]
    6. Applied egg-rr93.0%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{\left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity93.0%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{\color{blue}{1 \cdot \left(\left(1 + x\right) - x \cdot 1\right)}}{x \cdot \left(1 + x\right)}}} \]
      2. *-commutative93.0%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1 \cdot \left(\left(1 + x\right) - x \cdot 1\right)}{\color{blue}{\left(1 + x\right) \cdot x}}}} \]
      3. times-frac93.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{1}{1 + x} \cdot \frac{\left(1 + x\right) - x \cdot 1}{x}}}} \]
      4. +-commutative93.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{\color{blue}{x + 1}} \cdot \frac{\left(1 + x\right) - x \cdot 1}{x}}} \]
      5. *-rgt-identity93.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x + 1} \cdot \frac{\left(1 + x\right) - \color{blue}{x}}{x}}} \]
      6. associate--l+99.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x + 1} \cdot \frac{\color{blue}{1 + \left(x - x\right)}}{x}}} \]
      7. +-inverses99.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x + 1} \cdot \frac{1 + \color{blue}{0}}{x}}} \]
      8. metadata-eval99.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x + 1} \cdot \frac{\color{blue}{1}}{x}}} \]
    8. Applied egg-rr99.2%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{1}{x + 1} \cdot \frac{1}{x}}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification100.0%

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

Alternative 2: 99.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-24}:\\ \;\;\;\;{x}^{-1.5} \cdot \left(0.5 + \frac{0.5}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(1 + x\right) \cdot \left(x \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)\right)}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 2e-24)
   (* (pow x -1.5) (+ 0.5 (/ 0.5 x)))
   (/ 1.0 (* (+ 1.0 x) (* x (+ (pow x -0.5) (pow (+ 1.0 x) -0.5)))))))
double code(double x) {
	double tmp;
	if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-24) {
		tmp = pow(x, -1.5) * (0.5 + (0.5 / x));
	} else {
		tmp = 1.0 / ((1.0 + x) * (x * (pow(x, -0.5) + pow((1.0 + x), -0.5))));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((1.0d0 + x)))) <= 2d-24) then
        tmp = (x ** (-1.5d0)) * (0.5d0 + (0.5d0 / x))
    else
        tmp = 1.0d0 / ((1.0d0 + x) * (x * ((x ** (-0.5d0)) + ((1.0d0 + x) ** (-0.5d0)))))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (((1.0 / Math.sqrt(x)) + (-1.0 / Math.sqrt((1.0 + x)))) <= 2e-24) {
		tmp = Math.pow(x, -1.5) * (0.5 + (0.5 / x));
	} else {
		tmp = 1.0 / ((1.0 + x) * (x * (Math.pow(x, -0.5) + Math.pow((1.0 + x), -0.5))));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 2e-24:
		tmp = math.pow(x, -1.5) * (0.5 + (0.5 / x))
	else:
		tmp = 1.0 / ((1.0 + x) * (x * (math.pow(x, -0.5) + math.pow((1.0 + x), -0.5))))
	return tmp
function code(x)
	tmp = 0.0
	if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 2e-24)
		tmp = Float64((x ^ -1.5) * Float64(0.5 + Float64(0.5 / x)));
	else
		tmp = Float64(1.0 / Float64(Float64(1.0 + x) * Float64(x * Float64((x ^ -0.5) + (Float64(1.0 + x) ^ -0.5)))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-24)
		tmp = (x ^ -1.5) * (0.5 + (0.5 / x));
	else
		tmp = 1.0 / ((1.0 + x) * (x * ((x ^ -0.5) + ((1.0 + x) ^ -0.5))));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e-24], N[(N[Power[x, -1.5], $MachinePrecision] * N[(0.5 + N[(0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(1.0 + x), $MachinePrecision] * N[(x * N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-24}:\\
\;\;\;\;{x}^{-1.5} \cdot \left(0.5 + \frac{0.5}{x}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(1 + x\right) \cdot \left(x \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 x)) (/.f64 #s(literal 1 binary64) (sqrt.f64 (+.f64 x #s(literal 1 binary64))))) < 1.99999999999999985e-24

    1. Initial program 42.8%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 83.0%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \sqrt{\frac{1}{x}} - -0.5 \cdot \sqrt{x}}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. div-sub83.0%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \sqrt{\frac{1}{x}}}{{x}^{2}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}}} \]
      2. *-commutative83.0%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot -0.5}}{{x}^{2}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}} \]
      3. associate-/l*83.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}} \]
      4. *-commutative83.0%

        \[\leadsto \sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}} - \frac{\color{blue}{\sqrt{x} \cdot -0.5}}{{x}^{2}} \]
      5. associate-/l*83.0%

        \[\leadsto \sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}} - \color{blue}{\sqrt{x} \cdot \frac{-0.5}{{x}^{2}}} \]
      6. distribute-rgt-out--83.0%

        \[\leadsto \color{blue}{\frac{-0.5}{{x}^{2}} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)} \]
    5. Simplified83.0%

      \[\leadsto \color{blue}{\frac{-0.5}{{x}^{2}} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)} \]
    6. Taylor expanded in x around -inf 0.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{0.5 \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{x}} \]
    7. Step-by-step derivation
      1. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(0.5 \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)}{x}} \]
    8. Simplified99.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot 0.5}{x}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity99.7%

        \[\leadsto \color{blue}{1 \cdot \frac{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot 0.5}{x}} \]
      2. distribute-rgt-out99.7%

        \[\leadsto 1 \cdot \frac{\color{blue}{0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{x}}\right)}}{x} \]
      3. associate-/l*99.7%

        \[\leadsto 1 \cdot \color{blue}{\left(0.5 \cdot \frac{\sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{x}}}{x}\right)} \]
      4. pow-flip99.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{\sqrt{\color{blue}{{x}^{\left(-3\right)}}} + \sqrt{\frac{1}{x}}}{x}\right) \]
      5. sqrt-pow199.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{\color{blue}{{x}^{\left(\frac{-3}{2}\right)}} + \sqrt{\frac{1}{x}}}{x}\right) \]
      6. metadata-eval99.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{\left(\frac{\color{blue}{-3}}{2}\right)} + \sqrt{\frac{1}{x}}}{x}\right) \]
      7. metadata-eval99.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{\color{blue}{-1.5}} + \sqrt{\frac{1}{x}}}{x}\right) \]
      8. inv-pow99.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + \sqrt{\color{blue}{{x}^{-1}}}}{x}\right) \]
      9. sqrt-pow199.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + \color{blue}{{x}^{\left(\frac{-1}{2}\right)}}}{x}\right) \]
      10. metadata-eval99.7%

        \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + {x}^{\color{blue}{-0.5}}}{x}\right) \]
    10. Applied egg-rr99.7%

      \[\leadsto \color{blue}{1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}\right)} \]
    11. Step-by-step derivation
      1. *-lft-identity99.7%

        \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}} \]
    12. Simplified99.7%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}} \]
    13. Step-by-step derivation
      1. associate-*r/99.8%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left({x}^{-1.5} + {x}^{-0.5}\right)}{x}} \]
      2. associate-*l/99.6%

        \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \left({x}^{-1.5} + {x}^{-0.5}\right)} \]
      3. distribute-rgt-in99.6%

        \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{0.5}{x} + {x}^{-0.5} \cdot \frac{0.5}{x}} \]
      4. *-commutative99.6%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{\frac{0.5}{x} \cdot {x}^{-0.5}} \]
      5. div-inv99.6%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{\left(0.5 \cdot \frac{1}{x}\right)} \cdot {x}^{-0.5} \]
      6. associate-*l*99.6%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{0.5 \cdot \left(\frac{1}{x} \cdot {x}^{-0.5}\right)} \]
      7. inv-pow99.6%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \left(\color{blue}{{x}^{-1}} \cdot {x}^{-0.5}\right) \]
      8. metadata-eval99.6%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \left({x}^{\color{blue}{\left(-0.5 + -0.5\right)}} \cdot {x}^{-0.5}\right) \]
      9. pow-prod-up99.3%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \left(\color{blue}{\left({x}^{-0.5} \cdot {x}^{-0.5}\right)} \cdot {x}^{-0.5}\right) \]
      10. unpow399.3%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \color{blue}{{\left({x}^{-0.5}\right)}^{3}} \]
      11. pow-pow100.0%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \color{blue}{{x}^{\left(-0.5 \cdot 3\right)}} \]
      12. metadata-eval100.0%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot {x}^{\color{blue}{-1.5}} \]
    14. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot {x}^{-1.5}} \]
    15. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{{x}^{-1.5} \cdot 0.5} \]
      2. distribute-lft-out100.0%

        \[\leadsto \color{blue}{{x}^{-1.5} \cdot \left(\frac{0.5}{x} + 0.5\right)} \]
    16. Simplified100.0%

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot \left(\frac{0.5}{x} + 0.5\right)} \]

    if 1.99999999999999985e-24 < (-.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 x)) (/.f64 #s(literal 1 binary64) (sqrt.f64 (+.f64 x #s(literal 1 binary64)))))

    1. Initial program 59.1%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--58.1%

        \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
      2. clear-num58.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}}} \]
      3. inv-pow58.1%

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

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

        \[\leadsto \frac{1}{\frac{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      6. inv-pow58.1%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + \color{blue}{{\left(\sqrt{x + 1}\right)}^{-1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      7. sqrt-pow258.1%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(\frac{-1}{2}\right)}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      8. +-commutative58.1%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\color{blue}{\left(1 + x\right)}}^{\left(\frac{-1}{2}\right)}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      9. metadata-eval58.1%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{\color{blue}{-0.5}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      10. frac-times59.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{1 \cdot 1}{\sqrt{x} \cdot \sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      11. metadata-eval59.2%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      12. add-sqr-sqrt58.8%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{\color{blue}{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
      13. frac-times60.0%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}}} \]
      14. metadata-eval60.0%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}} \]
      15. add-sqr-sqrt61.0%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{1}{\color{blue}{x + 1}}}} \]
      16. +-commutative61.0%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}} \]
    4. Applied egg-rr61.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{1}{1 + x}}}} \]
    5. Step-by-step derivation
      1. frac-sub98.7%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{1 \cdot \left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}} \]
      2. *-un-lft-identity98.7%

        \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{\color{blue}{\left(1 + x\right)} - x \cdot 1}{x \cdot \left(1 + x\right)}}} \]
    6. Applied egg-rr98.7%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{\left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}} \]
    7. Step-by-step derivation
      1. associate-/r/99.1%

        \[\leadsto \frac{1}{\color{blue}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\left(1 + x\right) - x \cdot 1} \cdot \left(x \cdot \left(1 + x\right)\right)}} \]
      2. associate-*r*99.0%

        \[\leadsto \frac{1}{\color{blue}{\left(\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\left(1 + x\right) - x \cdot 1} \cdot x\right) \cdot \left(1 + x\right)}} \]
      3. flip-+61.1%

        \[\leadsto \frac{1}{\left(\frac{\color{blue}{\frac{{x}^{-0.5} \cdot {x}^{-0.5} - {\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}}}}{\left(1 + x\right) - x \cdot 1} \cdot x\right) \cdot \left(1 + x\right)} \]
      4. *-rgt-identity61.1%

        \[\leadsto \frac{1}{\left(\frac{\frac{{x}^{-0.5} \cdot {x}^{-0.5} - {\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}}}{\left(1 + x\right) - \color{blue}{x}} \cdot x\right) \cdot \left(1 + x\right)} \]
      5. associate--l+61.2%

        \[\leadsto \frac{1}{\left(\frac{\frac{{x}^{-0.5} \cdot {x}^{-0.5} - {\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}}}{\color{blue}{1 + \left(x - x\right)}} \cdot x\right) \cdot \left(1 + x\right)} \]
      6. +-inverses61.2%

        \[\leadsto \frac{1}{\left(\frac{\frac{{x}^{-0.5} \cdot {x}^{-0.5} - {\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}}}{1 + \color{blue}{0}} \cdot x\right) \cdot \left(1 + x\right)} \]
      7. metadata-eval61.2%

        \[\leadsto \frac{1}{\left(\frac{\frac{{x}^{-0.5} \cdot {x}^{-0.5} - {\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}}}{\color{blue}{1}} \cdot x\right) \cdot \left(1 + x\right)} \]
      8. associate-/l/61.2%

        \[\leadsto \frac{1}{\left(\color{blue}{\frac{{x}^{-0.5} \cdot {x}^{-0.5} - {\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}{1 \cdot \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right)}} \cdot x\right) \cdot \left(1 + x\right)} \]
      9. *-un-lft-identity61.2%

        \[\leadsto \frac{1}{\left(\frac{{x}^{-0.5} \cdot {x}^{-0.5} - {\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}{\color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}}} \cdot x\right) \cdot \left(1 + x\right)} \]
      10. flip-+99.3%

        \[\leadsto \frac{1}{\left(\color{blue}{\left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \cdot x\right) \cdot \left(1 + x\right)} \]
      11. +-commutative99.3%

        \[\leadsto \frac{1}{\left(\left({x}^{-0.5} + {\color{blue}{\left(x + 1\right)}}^{-0.5}\right) \cdot x\right) \cdot \left(1 + x\right)} \]
      12. +-commutative99.3%

        \[\leadsto \frac{1}{\left(\left({x}^{-0.5} + {\left(x + 1\right)}^{-0.5}\right) \cdot x\right) \cdot \color{blue}{\left(x + 1\right)}} \]
    8. Applied egg-rr99.3%

      \[\leadsto \frac{1}{\color{blue}{\left(\left({x}^{-0.5} + {\left(x + 1\right)}^{-0.5}\right) \cdot x\right) \cdot \left(x + 1\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification100.0%

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

Alternative 3: 97.7% accurate, 1.9× speedup?

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

\\
{x}^{-1.5} \cdot \left(0.5 + \frac{0.5}{x}\right)
\end{array}
Derivation
  1. Initial program 43.7%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 82.0%

    \[\leadsto \color{blue}{\frac{-0.5 \cdot \sqrt{\frac{1}{x}} - -0.5 \cdot \sqrt{x}}{{x}^{2}}} \]
  4. Step-by-step derivation
    1. div-sub82.0%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \sqrt{\frac{1}{x}}}{{x}^{2}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}}} \]
    2. *-commutative82.0%

      \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot -0.5}}{{x}^{2}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}} \]
    3. associate-/l*82.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}} \]
    4. *-commutative82.0%

      \[\leadsto \sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}} - \frac{\color{blue}{\sqrt{x} \cdot -0.5}}{{x}^{2}} \]
    5. associate-/l*81.9%

      \[\leadsto \sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}} - \color{blue}{\sqrt{x} \cdot \frac{-0.5}{{x}^{2}}} \]
    6. distribute-rgt-out--81.9%

      \[\leadsto \color{blue}{\frac{-0.5}{{x}^{2}} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)} \]
  5. Simplified81.9%

    \[\leadsto \color{blue}{\frac{-0.5}{{x}^{2}} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)} \]
  6. Taylor expanded in x around -inf 0.0%

    \[\leadsto \color{blue}{-1 \cdot \frac{0.5 \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{x}} \]
  7. Step-by-step derivation
    1. associate-*r/0.0%

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(0.5 \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)}{x}} \]
  8. Simplified97.6%

    \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot 0.5}{x}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity97.6%

      \[\leadsto \color{blue}{1 \cdot \frac{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot 0.5}{x}} \]
    2. distribute-rgt-out97.6%

      \[\leadsto 1 \cdot \frac{\color{blue}{0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{x}}\right)}}{x} \]
    3. associate-/l*97.6%

      \[\leadsto 1 \cdot \color{blue}{\left(0.5 \cdot \frac{\sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{x}}}{x}\right)} \]
    4. pow-flip97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{\sqrt{\color{blue}{{x}^{\left(-3\right)}}} + \sqrt{\frac{1}{x}}}{x}\right) \]
    5. sqrt-pow197.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{\color{blue}{{x}^{\left(\frac{-3}{2}\right)}} + \sqrt{\frac{1}{x}}}{x}\right) \]
    6. metadata-eval97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{\left(\frac{\color{blue}{-3}}{2}\right)} + \sqrt{\frac{1}{x}}}{x}\right) \]
    7. metadata-eval97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{\color{blue}{-1.5}} + \sqrt{\frac{1}{x}}}{x}\right) \]
    8. inv-pow97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + \sqrt{\color{blue}{{x}^{-1}}}}{x}\right) \]
    9. sqrt-pow197.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + \color{blue}{{x}^{\left(\frac{-1}{2}\right)}}}{x}\right) \]
    10. metadata-eval97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + {x}^{\color{blue}{-0.5}}}{x}\right) \]
  10. Applied egg-rr97.6%

    \[\leadsto \color{blue}{1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}\right)} \]
  11. Step-by-step derivation
    1. *-lft-identity97.6%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}} \]
  12. Simplified97.6%

    \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}} \]
  13. Step-by-step derivation
    1. associate-*r/97.7%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left({x}^{-1.5} + {x}^{-0.5}\right)}{x}} \]
    2. associate-*l/97.5%

      \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \left({x}^{-1.5} + {x}^{-0.5}\right)} \]
    3. distribute-rgt-in97.5%

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{0.5}{x} + {x}^{-0.5} \cdot \frac{0.5}{x}} \]
    4. *-commutative97.5%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{\frac{0.5}{x} \cdot {x}^{-0.5}} \]
    5. div-inv97.5%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{\left(0.5 \cdot \frac{1}{x}\right)} \cdot {x}^{-0.5} \]
    6. associate-*l*97.5%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{0.5 \cdot \left(\frac{1}{x} \cdot {x}^{-0.5}\right)} \]
    7. inv-pow97.5%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \left(\color{blue}{{x}^{-1}} \cdot {x}^{-0.5}\right) \]
    8. metadata-eval97.5%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \left({x}^{\color{blue}{\left(-0.5 + -0.5\right)}} \cdot {x}^{-0.5}\right) \]
    9. pow-prod-up97.2%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \left(\color{blue}{\left({x}^{-0.5} \cdot {x}^{-0.5}\right)} \cdot {x}^{-0.5}\right) \]
    10. unpow397.2%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \color{blue}{{\left({x}^{-0.5}\right)}^{3}} \]
    11. pow-pow97.9%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot \color{blue}{{x}^{\left(-0.5 \cdot 3\right)}} \]
    12. metadata-eval97.9%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot {x}^{\color{blue}{-1.5}} \]
  14. Applied egg-rr97.9%

    \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{0.5}{x} + 0.5 \cdot {x}^{-1.5}} \]
  15. Step-by-step derivation
    1. *-commutative97.9%

      \[\leadsto {x}^{-1.5} \cdot \frac{0.5}{x} + \color{blue}{{x}^{-1.5} \cdot 0.5} \]
    2. distribute-lft-out97.9%

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot \left(\frac{0.5}{x} + 0.5\right)} \]
  16. Simplified97.9%

    \[\leadsto \color{blue}{{x}^{-1.5} \cdot \left(\frac{0.5}{x} + 0.5\right)} \]
  17. Final simplification97.9%

    \[\leadsto {x}^{-1.5} \cdot \left(0.5 + \frac{0.5}{x}\right) \]
  18. Add Preprocessing

Alternative 4: 97.6% accurate, 2.0× speedup?

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

\\
0.5 \cdot \frac{\sqrt{\frac{1}{x}}}{x}
\end{array}
Derivation
  1. Initial program 43.7%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 82.0%

    \[\leadsto \color{blue}{\frac{-0.5 \cdot \sqrt{\frac{1}{x}} - -0.5 \cdot \sqrt{x}}{{x}^{2}}} \]
  4. Step-by-step derivation
    1. div-sub82.0%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \sqrt{\frac{1}{x}}}{{x}^{2}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}}} \]
    2. *-commutative82.0%

      \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot -0.5}}{{x}^{2}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}} \]
    3. associate-/l*82.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}}} - \frac{-0.5 \cdot \sqrt{x}}{{x}^{2}} \]
    4. *-commutative82.0%

      \[\leadsto \sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}} - \frac{\color{blue}{\sqrt{x} \cdot -0.5}}{{x}^{2}} \]
    5. associate-/l*81.9%

      \[\leadsto \sqrt{\frac{1}{x}} \cdot \frac{-0.5}{{x}^{2}} - \color{blue}{\sqrt{x} \cdot \frac{-0.5}{{x}^{2}}} \]
    6. distribute-rgt-out--81.9%

      \[\leadsto \color{blue}{\frac{-0.5}{{x}^{2}} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)} \]
  5. Simplified81.9%

    \[\leadsto \color{blue}{\frac{-0.5}{{x}^{2}} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)} \]
  6. Taylor expanded in x around -inf 0.0%

    \[\leadsto \color{blue}{-1 \cdot \frac{0.5 \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{x}} \]
  7. Step-by-step derivation
    1. associate-*r/0.0%

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(0.5 \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)}{x}} \]
  8. Simplified97.6%

    \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot 0.5}{x}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity97.6%

      \[\leadsto \color{blue}{1 \cdot \frac{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot 0.5}{x}} \]
    2. distribute-rgt-out97.6%

      \[\leadsto 1 \cdot \frac{\color{blue}{0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{x}}\right)}}{x} \]
    3. associate-/l*97.6%

      \[\leadsto 1 \cdot \color{blue}{\left(0.5 \cdot \frac{\sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{x}}}{x}\right)} \]
    4. pow-flip97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{\sqrt{\color{blue}{{x}^{\left(-3\right)}}} + \sqrt{\frac{1}{x}}}{x}\right) \]
    5. sqrt-pow197.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{\color{blue}{{x}^{\left(\frac{-3}{2}\right)}} + \sqrt{\frac{1}{x}}}{x}\right) \]
    6. metadata-eval97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{\left(\frac{\color{blue}{-3}}{2}\right)} + \sqrt{\frac{1}{x}}}{x}\right) \]
    7. metadata-eval97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{\color{blue}{-1.5}} + \sqrt{\frac{1}{x}}}{x}\right) \]
    8. inv-pow97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + \sqrt{\color{blue}{{x}^{-1}}}}{x}\right) \]
    9. sqrt-pow197.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + \color{blue}{{x}^{\left(\frac{-1}{2}\right)}}}{x}\right) \]
    10. metadata-eval97.6%

      \[\leadsto 1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + {x}^{\color{blue}{-0.5}}}{x}\right) \]
  10. Applied egg-rr97.6%

    \[\leadsto \color{blue}{1 \cdot \left(0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}\right)} \]
  11. Step-by-step derivation
    1. *-lft-identity97.6%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}} \]
  12. Simplified97.6%

    \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{-1.5} + {x}^{-0.5}}{x}} \]
  13. Taylor expanded in x around inf 97.7%

    \[\leadsto 0.5 \cdot \frac{\color{blue}{\sqrt{\frac{1}{x}}}}{x} \]
  14. Final simplification97.7%

    \[\leadsto 0.5 \cdot \frac{\sqrt{\frac{1}{x}}}{x} \]
  15. Add Preprocessing

Alternative 5: 44.0% accurate, 2.0× speedup?

\[\begin{array}{l} \\ {x}^{-1.5} \end{array} \]
(FPCore (x) :precision binary64 (pow x -1.5))
double code(double x) {
	return pow(x, -1.5);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = x ** (-1.5d0)
end function
public static double code(double x) {
	return Math.pow(x, -1.5);
}
def code(x):
	return math.pow(x, -1.5)
function code(x)
	return x ^ -1.5
end
function tmp = code(x)
	tmp = x ^ -1.5;
end
code[x_] := N[Power[x, -1.5], $MachinePrecision]
\begin{array}{l}

\\
{x}^{-1.5}
\end{array}
Derivation
  1. Initial program 43.7%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--43.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
    2. clear-num43.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}}} \]
    3. inv-pow43.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{{\left(\sqrt{x}\right)}^{-1}} + \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    4. sqrt-pow243.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    5. metadata-eval43.6%

      \[\leadsto \frac{1}{\frac{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    6. inv-pow43.6%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + \color{blue}{{\left(\sqrt{x + 1}\right)}^{-1}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    7. sqrt-pow243.6%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(\frac{-1}{2}\right)}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    8. +-commutative43.6%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\color{blue}{\left(1 + x\right)}}^{\left(\frac{-1}{2}\right)}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    9. metadata-eval43.6%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{\color{blue}{-0.5}}}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    10. frac-times23.8%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{1 \cdot 1}{\sqrt{x} \cdot \sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    11. metadata-eval23.8%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    12. add-sqr-sqrt21.6%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{\color{blue}{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}} \]
    13. frac-times26.0%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}}} \]
    14. metadata-eval26.0%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}} \]
    15. add-sqr-sqrt43.8%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{1}{\color{blue}{x + 1}}}} \]
    16. +-commutative43.8%

      \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}} \]
  4. Applied egg-rr43.8%

    \[\leadsto \color{blue}{\frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{x} - \frac{1}{1 + x}}}} \]
  5. Taylor expanded in x around inf 81.7%

    \[\leadsto \frac{1}{\frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\color{blue}{\frac{1}{{x}^{2}}}}} \]
  6. Taylor expanded in x around 0 45.1%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{{x}^{3}}}} \]
  7. Step-by-step derivation
    1. metadata-eval45.1%

      \[\leadsto \sqrt{\frac{\color{blue}{{1}^{3}}}{{x}^{3}}} \]
    2. cube-div45.2%

      \[\leadsto \sqrt{\color{blue}{{\left(\frac{1}{x}\right)}^{3}}} \]
  8. Simplified45.2%

    \[\leadsto \color{blue}{\sqrt{{\left(\frac{1}{x}\right)}^{3}}} \]
  9. Step-by-step derivation
    1. sqrt-pow148.8%

      \[\leadsto \color{blue}{{\left(\frac{1}{x}\right)}^{\left(\frac{3}{2}\right)}} \]
    2. inv-pow48.8%

      \[\leadsto {\color{blue}{\left({x}^{-1}\right)}}^{\left(\frac{3}{2}\right)} \]
    3. pow-pow48.8%

      \[\leadsto \color{blue}{{x}^{\left(-1 \cdot \frac{3}{2}\right)}} \]
    4. metadata-eval48.8%

      \[\leadsto {x}^{\left(-1 \cdot \color{blue}{1.5}\right)} \]
    5. metadata-eval48.8%

      \[\leadsto {x}^{\color{blue}{-1.5}} \]
    6. *-un-lft-identity48.8%

      \[\leadsto \color{blue}{1 \cdot {x}^{-1.5}} \]
    7. *-commutative48.8%

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot 1} \]
  10. Applied egg-rr48.8%

    \[\leadsto \color{blue}{{x}^{-1.5} \cdot 1} \]
  11. Step-by-step derivation
    1. *-rgt-identity48.8%

      \[\leadsto \color{blue}{{x}^{-1.5}} \]
  12. Simplified48.8%

    \[\leadsto \color{blue}{{x}^{-1.5}} \]
  13. Final simplification48.8%

    \[\leadsto {x}^{-1.5} \]
  14. Add Preprocessing

Developer target: 98.4% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024075 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64
  :pre (and (> x 1.0) (< x 1e+308))

  :alt
  (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))

  (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))