2isqrt (example 3.6)

Percentage Accurate: 39.2% → 99.9%
Time: 9.4s
Alternatives: 7
Speedup: 1.9×

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 7 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: 39.2% 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.4× 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(\frac{-0.5}{x} - -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}}{\mathsf{fma}\left(x, x, x\right)}\\ \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 x) -0.5))
   (/ (/ 1.0 (+ (pow x -0.5) (pow (+ 1.0 x) -0.5))) (fma x x 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 / x) - -0.5);
	} else {
		tmp = (1.0 / (pow(x, -0.5) + pow((1.0 + x), -0.5))) / fma(x, x, 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(Float64(-0.5 / x) - -0.5));
	else
		tmp = Float64(Float64(1.0 / Float64((x ^ -0.5) + (Float64(1.0 + x) ^ -0.5))) / fma(x, x, x));
	end
	return 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[(N[(-0.5 / x), $MachinePrecision] - -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * x + x), $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(\frac{-0.5}{x} - -0.5\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}}{\mathsf{fma}\left(x, x, x\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))))) < 0.0

    1. Initial program 38.1%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.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. distribute-lft-out--85.0%

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)}{{x}^{2}}} \]
    6. Step-by-step derivation
      1. *-commutative85.0%

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

        \[\leadsto \frac{\left(\sqrt{\frac{1}{x}} - \sqrt{x}\right) \cdot -0.5}{\color{blue}{x \cdot x}} \]
      3. times-frac99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{x}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
      4. inv-pow99.5%

        \[\leadsto \frac{\sqrt{\color{blue}{{x}^{-1}}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
      5. sqrt-pow199.5%

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

        \[\leadsto \frac{{x}^{\color{blue}{-0.5}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
    7. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
    8. Step-by-step derivation
      1. clear-num99.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{x}{{x}^{-0.5} - \sqrt{x}}}} \cdot \frac{-0.5}{x} \]
      2. clear-num99.5%

        \[\leadsto \frac{1}{\frac{x}{{x}^{-0.5} - \sqrt{x}}} \cdot \color{blue}{\frac{1}{\frac{x}{-0.5}}} \]
      3. frac-times98.3%

        \[\leadsto \color{blue}{\frac{1 \cdot 1}{\frac{x}{{x}^{-0.5} - \sqrt{x}} \cdot \frac{x}{-0.5}}} \]
      4. metadata-eval98.3%

        \[\leadsto \frac{\color{blue}{1}}{\frac{x}{{x}^{-0.5} - \sqrt{x}} \cdot \frac{x}{-0.5}} \]
      5. clear-num98.2%

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

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\frac{{x}^{-0.5}}{x} - \frac{\sqrt{x}}{x}}} \cdot \frac{x}{-0.5}} \]
      7. pow198.2%

        \[\leadsto \frac{1}{\frac{1}{\frac{{x}^{-0.5}}{\color{blue}{{x}^{1}}} - \frac{\sqrt{x}}{x}} \cdot \frac{x}{-0.5}} \]
      8. pow-div98.2%

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

        \[\leadsto \frac{1}{\frac{1}{{x}^{\color{blue}{-1.5}} - \frac{\sqrt{x}}{x}} \cdot \frac{x}{-0.5}} \]
      10. pow1/298.2%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - \frac{\color{blue}{{x}^{0.5}}}{x}} \cdot \frac{x}{-0.5}} \]
      11. pow198.2%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - \frac{{x}^{0.5}}{\color{blue}{{x}^{1}}}} \cdot \frac{x}{-0.5}} \]
      12. pow-div98.3%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - \color{blue}{{x}^{\left(0.5 - 1\right)}}} \cdot \frac{x}{-0.5}} \]
      13. metadata-eval98.3%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - {x}^{\color{blue}{-0.5}}} \cdot \frac{x}{-0.5}} \]
      14. div-inv98.3%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}} \cdot \color{blue}{\left(x \cdot \frac{1}{-0.5}\right)}} \]
      15. metadata-eval98.3%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}} \cdot \left(x \cdot \color{blue}{-2}\right)} \]
    9. Applied egg-rr98.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}} \cdot \left(x \cdot -2\right)}} \]
    10. Step-by-step derivation
      1. associate-/r*99.6%

        \[\leadsto \color{blue}{\frac{\frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}}}}{x \cdot -2}} \]
      2. remove-double-div99.7%

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

      \[\leadsto \color{blue}{\frac{{x}^{-1.5} - {x}^{-0.5}}{x \cdot -2}} \]
    12. Step-by-step derivation
      1. div-sub99.7%

        \[\leadsto \color{blue}{\frac{{x}^{-1.5}}{x \cdot -2} - \frac{{x}^{-0.5}}{x \cdot -2}} \]
      2. sub-neg99.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{-0.5}{x} + \left(--0.5 \cdot {x}^{-1.5}\right)} \]
    14. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{-0.5}{x} - -0.5 \cdot {x}^{-1.5}} \]
      2. *-commutative100.0%

        \[\leadsto {x}^{-1.5} \cdot \frac{-0.5}{x} - \color{blue}{{x}^{-1.5} \cdot -0.5} \]
      3. distribute-lft-out--100.0%

        \[\leadsto \color{blue}{{x}^{-1.5} \cdot \left(\frac{-0.5}{x} - -0.5\right)} \]
    15. 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 57.0%

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} + \left(-\frac{1}{\sqrt{x + 1}}\right)} \]
      2. inv-pow57.0%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
      3. sqrt-pow256.9%

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

        \[\leadsto {x}^{\color{blue}{-0.5}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
      5. distribute-neg-frac56.9%

        \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{x + 1}}} \]
      6. metadata-eval56.9%

        \[\leadsto {x}^{-0.5} + \frac{\color{blue}{-1}}{\sqrt{x + 1}} \]
      7. +-commutative56.9%

        \[\leadsto {x}^{-0.5} + \frac{-1}{\sqrt{\color{blue}{1 + x}}} \]
    4. Applied egg-rr56.9%

      \[\leadsto \color{blue}{{x}^{-0.5} + \frac{-1}{\sqrt{1 + x}}} \]
    5. Step-by-step derivation
      1. *-rgt-identity56.9%

        \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{1 + x}} \cdot 1} \]
      2. cancel-sign-sub56.9%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left(-\frac{-1}{\sqrt{1 + x}}\right) \cdot 1} \]
      3. distribute-lft-neg-in56.9%

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

        \[\leadsto {x}^{-0.5} - \left(-\color{blue}{\frac{-1}{\sqrt{1 + x}}}\right) \]
      5. distribute-neg-frac56.9%

        \[\leadsto {x}^{-0.5} - \color{blue}{\frac{--1}{\sqrt{1 + x}}} \]
      6. metadata-eval56.9%

        \[\leadsto {x}^{-0.5} - \frac{\color{blue}{1}}{\sqrt{1 + x}} \]
      7. unpow1/256.9%

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

        \[\leadsto {x}^{-0.5} - \frac{1}{\color{blue}{e^{\log \left(1 + x\right) \cdot 0.5}}} \]
      9. log1p-undefine52.8%

        \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5}} \]
      10. *-commutative52.8%

        \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{0.5 \cdot \mathsf{log1p}\left(x\right)}}} \]
      11. exp-neg53.5%

        \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
      12. *-commutative53.5%

        \[\leadsto {x}^{-0.5} - e^{-\color{blue}{\mathsf{log1p}\left(x\right) \cdot 0.5}} \]
      13. distribute-rgt-neg-in53.5%

        \[\leadsto {x}^{-0.5} - e^{\color{blue}{\mathsf{log1p}\left(x\right) \cdot \left(-0.5\right)}} \]
      14. log1p-undefine53.5%

        \[\leadsto {x}^{-0.5} - e^{\color{blue}{\log \left(1 + x\right)} \cdot \left(-0.5\right)} \]
      15. metadata-eval53.5%

        \[\leadsto {x}^{-0.5} - e^{\log \left(1 + x\right) \cdot \color{blue}{-0.5}} \]
      16. exp-to-pow57.0%

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

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

        \[\leadsto \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}}} \]
      2. pow-prod-up57.4%

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{1}{1 + x}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
      8. un-div-inv58.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot \frac{\frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}}{\color{blue}{\mathsf{fma}\left(x, x, x\right)}} \]
    12. Applied egg-rr99.4%

      \[\leadsto \color{blue}{1 \cdot \frac{\frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}}{\mathsf{fma}\left(x, x, x\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 0:\\ \;\;\;\;{x}^{-1.5} \cdot \left(\frac{-0.5}{x} - -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}}{\mathsf{fma}\left(x, x, x\right)}\\ \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 0:\\ \;\;\;\;{x}^{-1.5} \cdot \left(\frac{-0.5}{x} - -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right) \cdot \left(x \cdot \left(-1 - x\right)\right)}\\ \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 x) -0.5))
   (/ -1.0 (* (+ (pow x -0.5) (pow (+ 1.0 x) -0.5)) (* 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 / x) - -0.5);
	} else {
		tmp = -1.0 / ((pow(x, -0.5) + pow((1.0 + x), -0.5)) * (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) / x) - (-0.5d0))
    else
        tmp = (-1.0d0) / (((x ** (-0.5d0)) + ((1.0d0 + x) ** (-0.5d0))) * (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 / x) - -0.5);
	} else {
		tmp = -1.0 / ((Math.pow(x, -0.5) + Math.pow((1.0 + x), -0.5)) * (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 / x) - -0.5)
	else:
		tmp = -1.0 / ((math.pow(x, -0.5) + math.pow((1.0 + x), -0.5)) * (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(Float64(-0.5 / x) - -0.5));
	else
		tmp = Float64(-1.0 / Float64(Float64((x ^ -0.5) + (Float64(1.0 + x) ^ -0.5)) * Float64(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 / x) - -0.5);
	else
		tmp = -1.0 / (((x ^ -0.5) + ((1.0 + x) ^ -0.5)) * (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[(N[(-0.5 / x), $MachinePrecision] - -0.5), $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[(x * 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(\frac{-0.5}{x} - -0.5\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{\left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right) \cdot \left(x \cdot \left(-1 - x\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))))) < 0.0

    1. Initial program 38.1%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.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. distribute-lft-out--85.0%

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)}{{x}^{2}}} \]
    6. Step-by-step derivation
      1. *-commutative85.0%

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

        \[\leadsto \frac{\left(\sqrt{\frac{1}{x}} - \sqrt{x}\right) \cdot -0.5}{\color{blue}{x \cdot x}} \]
      3. times-frac99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{x}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
      4. inv-pow99.5%

        \[\leadsto \frac{\sqrt{\color{blue}{{x}^{-1}}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
      5. sqrt-pow199.5%

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

        \[\leadsto \frac{{x}^{\color{blue}{-0.5}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
    7. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
    8. Step-by-step derivation
      1. clear-num99.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{x}{{x}^{-0.5} - \sqrt{x}}}} \cdot \frac{-0.5}{x} \]
      2. clear-num99.5%

        \[\leadsto \frac{1}{\frac{x}{{x}^{-0.5} - \sqrt{x}}} \cdot \color{blue}{\frac{1}{\frac{x}{-0.5}}} \]
      3. frac-times98.3%

        \[\leadsto \color{blue}{\frac{1 \cdot 1}{\frac{x}{{x}^{-0.5} - \sqrt{x}} \cdot \frac{x}{-0.5}}} \]
      4. metadata-eval98.3%

        \[\leadsto \frac{\color{blue}{1}}{\frac{x}{{x}^{-0.5} - \sqrt{x}} \cdot \frac{x}{-0.5}} \]
      5. clear-num98.2%

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

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\frac{{x}^{-0.5}}{x} - \frac{\sqrt{x}}{x}}} \cdot \frac{x}{-0.5}} \]
      7. pow198.2%

        \[\leadsto \frac{1}{\frac{1}{\frac{{x}^{-0.5}}{\color{blue}{{x}^{1}}} - \frac{\sqrt{x}}{x}} \cdot \frac{x}{-0.5}} \]
      8. pow-div98.2%

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

        \[\leadsto \frac{1}{\frac{1}{{x}^{\color{blue}{-1.5}} - \frac{\sqrt{x}}{x}} \cdot \frac{x}{-0.5}} \]
      10. pow1/298.2%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - \frac{\color{blue}{{x}^{0.5}}}{x}} \cdot \frac{x}{-0.5}} \]
      11. pow198.2%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - \frac{{x}^{0.5}}{\color{blue}{{x}^{1}}}} \cdot \frac{x}{-0.5}} \]
      12. pow-div98.3%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - \color{blue}{{x}^{\left(0.5 - 1\right)}}} \cdot \frac{x}{-0.5}} \]
      13. metadata-eval98.3%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - {x}^{\color{blue}{-0.5}}} \cdot \frac{x}{-0.5}} \]
      14. div-inv98.3%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}} \cdot \color{blue}{\left(x \cdot \frac{1}{-0.5}\right)}} \]
      15. metadata-eval98.3%

        \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}} \cdot \left(x \cdot \color{blue}{-2}\right)} \]
    9. Applied egg-rr98.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}} \cdot \left(x \cdot -2\right)}} \]
    10. Step-by-step derivation
      1. associate-/r*99.6%

        \[\leadsto \color{blue}{\frac{\frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}}}}{x \cdot -2}} \]
      2. remove-double-div99.7%

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

      \[\leadsto \color{blue}{\frac{{x}^{-1.5} - {x}^{-0.5}}{x \cdot -2}} \]
    12. Step-by-step derivation
      1. div-sub99.7%

        \[\leadsto \color{blue}{\frac{{x}^{-1.5}}{x \cdot -2} - \frac{{x}^{-0.5}}{x \cdot -2}} \]
      2. sub-neg99.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{-0.5}{x} + \left(--0.5 \cdot {x}^{-1.5}\right)} \]
    14. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{-0.5}{x} - -0.5 \cdot {x}^{-1.5}} \]
      2. *-commutative100.0%

        \[\leadsto {x}^{-1.5} \cdot \frac{-0.5}{x} - \color{blue}{{x}^{-1.5} \cdot -0.5} \]
      3. distribute-lft-out--100.0%

        \[\leadsto \color{blue}{{x}^{-1.5} \cdot \left(\frac{-0.5}{x} - -0.5\right)} \]
    15. 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 57.0%

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} + \left(-\frac{1}{\sqrt{x + 1}}\right)} \]
      2. inv-pow57.0%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
      3. sqrt-pow256.9%

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

        \[\leadsto {x}^{\color{blue}{-0.5}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
      5. distribute-neg-frac56.9%

        \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{x + 1}}} \]
      6. metadata-eval56.9%

        \[\leadsto {x}^{-0.5} + \frac{\color{blue}{-1}}{\sqrt{x + 1}} \]
      7. +-commutative56.9%

        \[\leadsto {x}^{-0.5} + \frac{-1}{\sqrt{\color{blue}{1 + x}}} \]
    4. Applied egg-rr56.9%

      \[\leadsto \color{blue}{{x}^{-0.5} + \frac{-1}{\sqrt{1 + x}}} \]
    5. Step-by-step derivation
      1. *-rgt-identity56.9%

        \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{1 + x}} \cdot 1} \]
      2. cancel-sign-sub56.9%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left(-\frac{-1}{\sqrt{1 + x}}\right) \cdot 1} \]
      3. distribute-lft-neg-in56.9%

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

        \[\leadsto {x}^{-0.5} - \left(-\color{blue}{\frac{-1}{\sqrt{1 + x}}}\right) \]
      5. distribute-neg-frac56.9%

        \[\leadsto {x}^{-0.5} - \color{blue}{\frac{--1}{\sqrt{1 + x}}} \]
      6. metadata-eval56.9%

        \[\leadsto {x}^{-0.5} - \frac{\color{blue}{1}}{\sqrt{1 + x}} \]
      7. unpow1/256.9%

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

        \[\leadsto {x}^{-0.5} - \frac{1}{\color{blue}{e^{\log \left(1 + x\right) \cdot 0.5}}} \]
      9. log1p-undefine52.8%

        \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5}} \]
      10. *-commutative52.8%

        \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{0.5 \cdot \mathsf{log1p}\left(x\right)}}} \]
      11. exp-neg53.5%

        \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
      12. *-commutative53.5%

        \[\leadsto {x}^{-0.5} - e^{-\color{blue}{\mathsf{log1p}\left(x\right) \cdot 0.5}} \]
      13. distribute-rgt-neg-in53.5%

        \[\leadsto {x}^{-0.5} - e^{\color{blue}{\mathsf{log1p}\left(x\right) \cdot \left(-0.5\right)}} \]
      14. log1p-undefine53.5%

        \[\leadsto {x}^{-0.5} - e^{\color{blue}{\log \left(1 + x\right)} \cdot \left(-0.5\right)} \]
      15. metadata-eval53.5%

        \[\leadsto {x}^{-0.5} - e^{\log \left(1 + x\right) \cdot \color{blue}{-0.5}} \]
      16. exp-to-pow57.0%

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

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

        \[\leadsto \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}}} \]
      2. pow-prod-up57.4%

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{1}{1 + x}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
      8. un-div-inv58.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{-1 \cdot \left(\left(1 + x\right) - x \cdot 1\right)}{-1 \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}}}{x \cdot \left(1 + x\right)} \]
      8. neg-mul-199.4%

        \[\leadsto \frac{\frac{\color{blue}{-\left(\left(1 + x\right) - x \cdot 1\right)}}{-1 \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}}{x \cdot \left(1 + x\right)} \]
      9. neg-mul-199.4%

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

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

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

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

Alternative 3: 37.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{x}}\\
\mathbf{if}\;x \leq 6.5 \cdot 10^{+153}:\\
\;\;\;\;t\_0 \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{x} \cdot t\_0\\


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

    1. Initial program 9.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--9.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. div-inv9.6%

        \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
      3. frac-times9.8%

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

        \[\leadsto \left(\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      5. add-sqr-sqrt9.7%

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

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

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

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

        \[\leadsto \left(\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      10. inv-pow9.7%

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

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \color{blue}{\left(0.5 \cdot \sqrt{x}\right)} \]
    6. Step-by-step derivation
      1. *-commutative8.3%

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

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \color{blue}{\left(\sqrt{x} \cdot 0.5\right)} \]
    8. Taylor expanded in x around 0 7.0%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]

    if 6.49999999999999972e153 < x

    1. Initial program 70.9%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 70.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. distribute-lft-out--70.9%

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)}{{x}^{2}}} \]
    6. Step-by-step derivation
      1. *-commutative70.9%

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

        \[\leadsto \frac{\left(\sqrt{\frac{1}{x}} - \sqrt{x}\right) \cdot -0.5}{\color{blue}{x \cdot x}} \]
      3. times-frac99.8%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{x}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
      4. inv-pow99.8%

        \[\leadsto \frac{\sqrt{\color{blue}{{x}^{-1}}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
      5. sqrt-pow199.8%

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

        \[\leadsto \frac{{x}^{\color{blue}{-0.5}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
    7. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
    8. Step-by-step derivation
      1. /-rgt-identity99.8%

        \[\leadsto \frac{{x}^{-0.5} - \color{blue}{\frac{\sqrt{x}}{1}}}{x} \cdot \frac{-0.5}{x} \]
      2. clear-num99.7%

        \[\leadsto \frac{{x}^{-0.5} - \color{blue}{\frac{1}{\frac{1}{\sqrt{x}}}}}{x} \cdot \frac{-0.5}{x} \]
      3. inv-pow99.7%

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

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

        \[\leadsto \frac{{x}^{-0.5} - \frac{1}{{x}^{\color{blue}{-0.5}}}}{x} \cdot \frac{-0.5}{x} \]
    9. Applied egg-rr99.7%

      \[\leadsto \frac{{x}^{-0.5} - \color{blue}{\frac{1}{{x}^{-0.5}}}}{x} \cdot \frac{-0.5}{x} \]
    10. Taylor expanded in x around -inf 70.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \cdot \frac{-0.5}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification37.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 6.5 \cdot 10^{+153}:\\ \;\;\;\;\sqrt{\frac{1}{x}} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.5}{x} \cdot \sqrt{\frac{1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 98.0% accurate, 1.9× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 84.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. distribute-lft-out--84.0%

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

    \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)}{{x}^{2}}} \]
  6. Step-by-step derivation
    1. *-commutative84.0%

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

      \[\leadsto \frac{\left(\sqrt{\frac{1}{x}} - \sqrt{x}\right) \cdot -0.5}{\color{blue}{x \cdot x}} \]
    3. times-frac97.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{x}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
    4. inv-pow97.7%

      \[\leadsto \frac{\sqrt{\color{blue}{{x}^{-1}}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
    5. sqrt-pow197.7%

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

      \[\leadsto \frac{{x}^{\color{blue}{-0.5}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
  7. Applied egg-rr97.7%

    \[\leadsto \color{blue}{\frac{{x}^{-0.5} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
  8. Step-by-step derivation
    1. clear-num97.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{x}{{x}^{-0.5} - \sqrt{x}}}} \cdot \frac{-0.5}{x} \]
    2. clear-num97.7%

      \[\leadsto \frac{1}{\frac{x}{{x}^{-0.5} - \sqrt{x}}} \cdot \color{blue}{\frac{1}{\frac{x}{-0.5}}} \]
    3. frac-times96.6%

      \[\leadsto \color{blue}{\frac{1 \cdot 1}{\frac{x}{{x}^{-0.5} - \sqrt{x}} \cdot \frac{x}{-0.5}}} \]
    4. metadata-eval96.6%

      \[\leadsto \frac{\color{blue}{1}}{\frac{x}{{x}^{-0.5} - \sqrt{x}} \cdot \frac{x}{-0.5}} \]
    5. clear-num96.5%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{{x}^{-0.5} - \sqrt{x}}{x}}} \cdot \frac{x}{-0.5}} \]
    6. div-sub96.5%

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\frac{{x}^{-0.5}}{x} - \frac{\sqrt{x}}{x}}} \cdot \frac{x}{-0.5}} \]
    7. pow196.5%

      \[\leadsto \frac{1}{\frac{1}{\frac{{x}^{-0.5}}{\color{blue}{{x}^{1}}} - \frac{\sqrt{x}}{x}} \cdot \frac{x}{-0.5}} \]
    8. pow-div96.5%

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

      \[\leadsto \frac{1}{\frac{1}{{x}^{\color{blue}{-1.5}} - \frac{\sqrt{x}}{x}} \cdot \frac{x}{-0.5}} \]
    10. pow1/296.5%

      \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - \frac{\color{blue}{{x}^{0.5}}}{x}} \cdot \frac{x}{-0.5}} \]
    11. pow196.5%

      \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - \frac{{x}^{0.5}}{\color{blue}{{x}^{1}}}} \cdot \frac{x}{-0.5}} \]
    12. pow-div96.6%

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

      \[\leadsto \frac{1}{\frac{1}{{x}^{-1.5} - {x}^{\color{blue}{-0.5}}} \cdot \frac{x}{-0.5}} \]
    14. div-inv96.6%

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}} \cdot \left(x \cdot -2\right)}} \]
  10. Step-by-step derivation
    1. associate-/r*97.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{1}{{x}^{-1.5} - {x}^{-0.5}}}}{x \cdot -2}} \]
    2. remove-double-div98.0%

      \[\leadsto \frac{\color{blue}{{x}^{-1.5} - {x}^{-0.5}}}{x \cdot -2} \]
  11. Simplified98.0%

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

      \[\leadsto \color{blue}{\frac{{x}^{-1.5}}{x \cdot -2} - \frac{{x}^{-0.5}}{x \cdot -2}} \]
    2. sub-neg98.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{-0.5}{x} + \left(--0.5 \cdot {x}^{-1.5}\right)} \]
  14. Step-by-step derivation
    1. sub-neg98.2%

      \[\leadsto \color{blue}{{x}^{-1.5} \cdot \frac{-0.5}{x} - -0.5 \cdot {x}^{-1.5}} \]
    2. *-commutative98.2%

      \[\leadsto {x}^{-1.5} \cdot \frac{-0.5}{x} - \color{blue}{{x}^{-1.5} \cdot -0.5} \]
    3. distribute-lft-out--98.2%

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

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

Alternative 5: 97.5% accurate, 1.9× speedup?

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

\\
\frac{-0.5}{x} \cdot \left(-\sqrt{\frac{1}{x}}\right)
\end{array}
Derivation
  1. Initial program 39.0%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 84.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. distribute-lft-out--84.0%

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

    \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)}{{x}^{2}}} \]
  6. Step-by-step derivation
    1. *-commutative84.0%

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

      \[\leadsto \frac{\left(\sqrt{\frac{1}{x}} - \sqrt{x}\right) \cdot -0.5}{\color{blue}{x \cdot x}} \]
    3. times-frac97.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{x}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
    4. inv-pow97.7%

      \[\leadsto \frac{\sqrt{\color{blue}{{x}^{-1}}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
    5. sqrt-pow197.7%

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

      \[\leadsto \frac{{x}^{\color{blue}{-0.5}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
  7. Applied egg-rr97.7%

    \[\leadsto \color{blue}{\frac{{x}^{-0.5} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
  8. Step-by-step derivation
    1. div-sub97.7%

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\color{blue}{\frac{1}{{x}^{3}}}} - \frac{\sqrt{x}}{x}\right) \cdot \frac{-0.5}{x} \]
    9. pow1/297.7%

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

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

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

      \[\leadsto \left(\sqrt{\frac{1}{{x}^{3}}} - {x}^{\color{blue}{-0.5}}\right) \cdot \frac{-0.5}{x} \]
    13. sub-neg97.8%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left({x}^{-1.5} - {x}^{-0.5}\right)} \cdot \frac{-0.5}{x} \]
  12. Taylor expanded in x around inf 97.7%

    \[\leadsto \color{blue}{\left(-1 \cdot \sqrt{\frac{1}{x}}\right)} \cdot \frac{-0.5}{x} \]
  13. Step-by-step derivation
    1. mul-1-neg97.7%

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

    \[\leadsto \color{blue}{\left(-\sqrt{\frac{1}{x}}\right)} \cdot \frac{-0.5}{x} \]
  15. Final simplification97.7%

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

Alternative 6: 5.6% accurate, 2.0× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--39.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. div-inv39.1%

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    10. inv-pow39.1%

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

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

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

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}} \]
    14. pow-flip39.1%

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

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

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

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

    \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \color{blue}{\left(0.5 \cdot \sqrt{x}\right)} \]
  6. Step-by-step derivation
    1. *-commutative38.4%

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

    \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \color{blue}{\left(\sqrt{x} \cdot 0.5\right)} \]
  8. Taylor expanded in x around 0 5.7%

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

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

Alternative 7: 5.6% accurate, 2.0× speedup?

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

\\
{x}^{-0.5}
\end{array}
Derivation
  1. Initial program 39.0%

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} + \left(-\frac{1}{\sqrt{x + 1}}\right)} \]
    2. inv-pow39.0%

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

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

      \[\leadsto {x}^{\color{blue}{-0.5}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
    5. distribute-neg-frac28.4%

      \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{x + 1}}} \]
    6. metadata-eval28.4%

      \[\leadsto {x}^{-0.5} + \frac{\color{blue}{-1}}{\sqrt{x + 1}} \]
    7. +-commutative28.4%

      \[\leadsto {x}^{-0.5} + \frac{-1}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr28.4%

    \[\leadsto \color{blue}{{x}^{-0.5} + \frac{-1}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. *-rgt-identity28.4%

      \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{1 + x}} \cdot 1} \]
    2. cancel-sign-sub28.4%

      \[\leadsto \color{blue}{{x}^{-0.5} - \left(-\frac{-1}{\sqrt{1 + x}}\right) \cdot 1} \]
    3. distribute-lft-neg-in28.4%

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

      \[\leadsto {x}^{-0.5} - \left(-\color{blue}{\frac{-1}{\sqrt{1 + x}}}\right) \]
    5. distribute-neg-frac28.4%

      \[\leadsto {x}^{-0.5} - \color{blue}{\frac{--1}{\sqrt{1 + x}}} \]
    6. metadata-eval28.4%

      \[\leadsto {x}^{-0.5} - \frac{\color{blue}{1}}{\sqrt{1 + x}} \]
    7. unpow1/228.4%

      \[\leadsto {x}^{-0.5} - \frac{1}{\color{blue}{{\left(1 + x\right)}^{0.5}}} \]
    8. exp-to-pow7.0%

      \[\leadsto {x}^{-0.5} - \frac{1}{\color{blue}{e^{\log \left(1 + x\right) \cdot 0.5}}} \]
    9. log1p-undefine7.0%

      \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5}} \]
    10. *-commutative7.0%

      \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{0.5 \cdot \mathsf{log1p}\left(x\right)}}} \]
    11. exp-neg7.1%

      \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
    12. *-commutative7.1%

      \[\leadsto {x}^{-0.5} - e^{-\color{blue}{\mathsf{log1p}\left(x\right) \cdot 0.5}} \]
    13. distribute-rgt-neg-in7.1%

      \[\leadsto {x}^{-0.5} - e^{\color{blue}{\mathsf{log1p}\left(x\right) \cdot \left(-0.5\right)}} \]
    14. log1p-undefine7.1%

      \[\leadsto {x}^{-0.5} - e^{\color{blue}{\log \left(1 + x\right)} \cdot \left(-0.5\right)} \]
    15. metadata-eval7.1%

      \[\leadsto {x}^{-0.5} - e^{\log \left(1 + x\right) \cdot \color{blue}{-0.5}} \]
    16. exp-to-pow39.0%

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  8. Step-by-step derivation
    1. unpow-15.7%

      \[\leadsto \sqrt{\color{blue}{{x}^{-1}}} \]
    2. metadata-eval5.7%

      \[\leadsto \sqrt{{x}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
    3. pow-sqr5.7%

      \[\leadsto \sqrt{\color{blue}{{x}^{-0.5} \cdot {x}^{-0.5}}} \]
    4. rem-sqrt-square5.7%

      \[\leadsto \color{blue}{\left|{x}^{-0.5}\right|} \]
    5. metadata-eval5.7%

      \[\leadsto \left|{x}^{\color{blue}{\left(2 \cdot -0.25\right)}}\right| \]
    6. pow-sqr5.7%

      \[\leadsto \left|\color{blue}{{x}^{-0.25} \cdot {x}^{-0.25}}\right| \]
    7. fabs-sqr5.7%

      \[\leadsto \color{blue}{{x}^{-0.25} \cdot {x}^{-0.25}} \]
    8. pow-sqr5.7%

      \[\leadsto \color{blue}{{x}^{\left(2 \cdot -0.25\right)}} \]
    9. metadata-eval5.7%

      \[\leadsto {x}^{\color{blue}{-0.5}} \]
  9. Simplified5.7%

    \[\leadsto \color{blue}{{x}^{-0.5}} \]
  10. Add Preprocessing

Developer Target 1: 98.2% 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 2024139 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64
  :pre (and (> x 1.0) (< x 1e+308))

  :alt
  (! :herbie-platform default (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1))))))

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