2isqrt (example 3.6)

Percentage Accurate: 38.4% → 99.5%
Time: 18.9s
Alternatives: 9
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 9 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.4% 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.5% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\\
\mathbf{if}\;x \leq 2 \cdot 10^{+116}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{1 + x}}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{t\_0}}{x}}{x}\\


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

    1. Initial program 12.2%

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

        \[\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-eval12.3%

        \[\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-sqrt12.5%

        \[\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-times12.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-eval12.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-sqrt12.5%

        \[\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. +-commutative12.5%

        \[\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-pow12.5%

        \[\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-pow212.5%

        \[\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-eval12.5%

        \[\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/212.5%

        \[\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-flip12.5%

        \[\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. +-commutative12.5%

        \[\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-eval12.5%

        \[\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-rr12.5%

      \[\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. Step-by-step derivation
      1. *-commutative12.5%

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

        \[\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)}} \]
      3. frac-times16.8%

        \[\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)}} \]
      4. *-un-lft-identity16.8%

        \[\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)} \]
      5. *-un-lft-identity16.8%

        \[\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)} \]
      6. *-rgt-identity16.8%

        \[\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)} \]
      7. distribute-lft-in16.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    8. Simplified99.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
    9. Step-by-step derivation
      1. metadata-eval99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000003e116 < x

    1. Initial program 53.2%

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

        \[\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-times30.0%

        \[\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-eval30.0%

        \[\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-sqrt24.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-times35.5%

        \[\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-eval35.5%

        \[\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-sqrt53.2%

        \[\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. +-commutative53.2%

        \[\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-pow53.2%

        \[\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-pow253.2%

        \[\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-eval53.2%

        \[\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/253.2%

        \[\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-flip53.2%

        \[\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. +-commutative53.2%

        \[\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-eval53.2%

        \[\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-rr53.2%

      \[\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 75.5%

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

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

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

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

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

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

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

Alternative 2: 99.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}\\ t\_0 \cdot \left(t\_0 \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (/ 1.0 (hypot x (sqrt x)))))
   (* t_0 (* t_0 (/ 1.0 (+ (pow x -0.5) (pow (+ 1.0 x) -0.5)))))))
double code(double x) {
	double t_0 = 1.0 / hypot(x, sqrt(x));
	return t_0 * (t_0 * (1.0 / (pow(x, -0.5) + pow((1.0 + x), -0.5))));
}
public static double code(double x) {
	double t_0 = 1.0 / Math.hypot(x, Math.sqrt(x));
	return t_0 * (t_0 * (1.0 / (Math.pow(x, -0.5) + Math.pow((1.0 + x), -0.5))));
}
def code(x):
	t_0 = 1.0 / math.hypot(x, math.sqrt(x))
	return t_0 * (t_0 * (1.0 / (math.pow(x, -0.5) + math.pow((1.0 + x), -0.5))))
function code(x)
	t_0 = Float64(1.0 / hypot(x, sqrt(x)))
	return Float64(t_0 * Float64(t_0 * Float64(1.0 / Float64((x ^ -0.5) + (Float64(1.0 + x) ^ -0.5)))))
end
function tmp = code(x)
	t_0 = 1.0 / hypot(x, sqrt(x));
	tmp = t_0 * (t_0 * (1.0 / ((x ^ -0.5) + ((1.0 + x) ^ -0.5))));
end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[x ^ 2 + N[Sqrt[x], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * N[(t$95$0 * N[(1.0 / 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}
t_0 := \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}\\
t\_0 \cdot \left(t\_0 \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 36.4%

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

      \[\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-inv36.4%

      \[\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-times22.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-eval22.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-sqrt19.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-times26.1%

      \[\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-eval26.1%

      \[\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-sqrt36.5%

      \[\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. +-commutative36.5%

      \[\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-pow36.5%

      \[\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-pow236.5%

      \[\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-eval36.5%

      \[\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/236.5%

      \[\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-flip36.5%

      \[\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. +-commutative36.5%

      \[\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-eval36.5%

      \[\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-rr36.5%

    \[\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. Step-by-step derivation
    1. *-commutative36.5%

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

      \[\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)}} \]
    3. frac-times38.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)}} \]
    4. *-un-lft-identity38.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)} \]
    5. *-un-lft-identity38.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)} \]
    6. *-rgt-identity38.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)} \]
    7. distribute-lft-in38.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  8. Simplified85.4%

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  9. Step-by-step derivation
    1. div-inv85.3%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(x, x, x\right)} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
    2. add-sqr-sqrt85.2%

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{\color{blue}{x \cdot x + x}}} \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(x, x, x\right)}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    7. add-sqr-sqrt85.2%

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

      \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{x}\right)}} \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(x, x, x\right)}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    9. sqrt-div85.1%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(x, x, x\right)}}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    10. metadata-eval85.1%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{\color{blue}{1}}{\sqrt{\mathsf{fma}\left(x, x, x\right)}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    11. fma-undefine85.1%

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{1}{\sqrt{x \cdot x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    13. hypot-define99.3%

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

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right)} \]
  11. Final simplification99.3%

    \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
  12. Add Preprocessing

Alternative 3: 99.5% accurate, 0.7× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(0.5 \cdot \sqrt{\frac{1}{x}}\right)\\


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

    1. Initial program 12.5%

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

        \[\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-inv12.5%

        \[\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-times12.7%

        \[\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-eval12.7%

        \[\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-sqrt12.9%

        \[\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-times13.1%

        \[\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-eval13.1%

        \[\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-sqrt12.9%

        \[\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. +-commutative12.9%

        \[\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-pow12.9%

        \[\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-pow212.9%

        \[\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-eval12.9%

        \[\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/212.9%

        \[\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-flip12.9%

        \[\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. +-commutative12.9%

        \[\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-eval12.9%

        \[\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-rr12.9%

      \[\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. Step-by-step derivation
      1. *-commutative12.9%

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

        \[\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)}} \]
      3. frac-times17.4%

        \[\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)}} \]
      4. *-un-lft-identity17.4%

        \[\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)} \]
      5. *-un-lft-identity17.4%

        \[\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)} \]
      6. *-rgt-identity17.4%

        \[\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)} \]
      7. distribute-lft-in17.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    8. Simplified99.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
    9. Step-by-step derivation
      1. metadata-eval99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e113 < x

    1. Initial program 51.7%

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

        \[\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-inv51.7%

        \[\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-times29.2%

        \[\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-eval29.2%

        \[\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-sqrt24.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-times34.5%

        \[\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-eval34.5%

        \[\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-sqrt51.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. +-commutative51.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-pow51.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-pow251.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-eval51.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/251.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-flip51.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. +-commutative51.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-eval51.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-rr51.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. Step-by-step derivation
      1. *-commutative51.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)} \]
      2. frac-sub51.7%

        \[\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)}} \]
      3. frac-times51.7%

        \[\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)}} \]
      4. *-un-lft-identity51.7%

        \[\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)} \]
      5. *-un-lft-identity51.7%

        \[\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)} \]
      6. *-rgt-identity51.7%

        \[\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)} \]
      7. distribute-lft-in51.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    8. Simplified76.3%

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
    9. Step-by-step derivation
      1. div-inv76.3%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(x, x, x\right)} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
      2. add-sqr-sqrt76.2%

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{x \cdot x + x}}} \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(x, x, x\right)}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
      7. add-sqr-sqrt76.2%

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{x}\right)}} \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(x, x, x\right)}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
      9. sqrt-div76.2%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(x, x, x\right)}}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
      10. metadata-eval76.2%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{\color{blue}{1}}{\sqrt{\mathsf{fma}\left(x, x, x\right)}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
      11. fma-undefine76.2%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{1}{\sqrt{\color{blue}{x \cdot x + x}}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
      12. add-sqr-sqrt76.2%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{1}{\sqrt{x \cdot x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
      13. hypot-define99.4%

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right)} \]
    11. Taylor expanded in x around inf 99.7%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{x}}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.6%

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

Alternative 4: 98.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \frac{1}{x \cdot \mathsf{fma}\left({x}^{-0.5}, 1 + x, {\left(1 + x\right)}^{0.5}\right)} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ 1.0 (* x (fma (pow x -0.5) (+ 1.0 x) (pow (+ 1.0 x) 0.5)))))
double code(double x) {
	return 1.0 / (x * fma(pow(x, -0.5), (1.0 + x), pow((1.0 + x), 0.5)));
}
function code(x)
	return Float64(1.0 / Float64(x * fma((x ^ -0.5), Float64(1.0 + x), (Float64(1.0 + x) ^ 0.5))))
end
code[x_] := N[(1.0 / N[(x * N[(N[Power[x, -0.5], $MachinePrecision] * N[(1.0 + x), $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{x \cdot \mathsf{fma}\left({x}^{-0.5}, 1 + x, {\left(1 + x\right)}^{0.5}\right)}
\end{array}
Derivation
  1. Initial program 36.4%

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

      \[\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-inv36.4%

      \[\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-times22.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-eval22.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-sqrt19.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-times26.1%

      \[\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-eval26.1%

      \[\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-sqrt36.5%

      \[\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. +-commutative36.5%

      \[\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-pow36.5%

      \[\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-pow236.5%

      \[\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-eval36.5%

      \[\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/236.5%

      \[\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-flip36.5%

      \[\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. +-commutative36.5%

      \[\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-eval36.5%

      \[\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-rr36.5%

    \[\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. Step-by-step derivation
    1. *-commutative36.5%

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

      \[\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)}} \]
    3. frac-times38.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)}} \]
    4. *-un-lft-identity38.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)} \]
    5. *-un-lft-identity38.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)} \]
    6. *-rgt-identity38.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)} \]
    7. distribute-lft-in38.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  8. Simplified85.4%

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  9. Step-by-step derivation
    1. div-inv85.3%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(x, x, x\right)} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
    2. add-sqr-sqrt85.2%

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{\color{blue}{x \cdot x + x}}} \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(x, x, x\right)}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    7. add-sqr-sqrt85.2%

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

      \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{x}\right)}} \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(x, x, x\right)}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    9. sqrt-div85.1%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(x, x, x\right)}}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    10. metadata-eval85.1%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{\color{blue}{1}}{\sqrt{\mathsf{fma}\left(x, x, x\right)}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    11. fma-undefine85.1%

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{1}{\sqrt{x \cdot x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}}} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right) \]
    13. hypot-define99.3%

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

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right)} \]
  11. Step-by-step derivation
    1. *-commutative99.3%

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot 1}{\left(\mathsf{hypot}\left(x, \sqrt{x}\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)\right) \cdot \mathsf{hypot}\left(x, \sqrt{x}\right)}} \]
    5. metadata-eval98.7%

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

    \[\leadsto \color{blue}{\frac{1}{\left(\mathsf{hypot}\left(x, \sqrt{x}\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)\right) \cdot \mathsf{hypot}\left(x, \sqrt{x}\right)}} \]
  13. Step-by-step derivation
    1. *-commutative98.7%

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

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

      \[\leadsto \frac{1}{\left(\color{blue}{\sqrt{x \cdot x + \sqrt{x} \cdot \sqrt{x}}} \cdot \mathsf{hypot}\left(x, \sqrt{x}\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    4. hypot-undefine85.3%

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(x, x, x\right)} \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    8. fma-undefine85.3%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{x \cdot \mathsf{fma}\left({x}^{-0.5}, 1 + x, {\left(1 + x\right)}^{0.5}\right)} \]
  16. Add Preprocessing

Alternative 5: 97.4% accurate, 1.0× speedup?

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

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

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

      \[\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-inv36.4%

      \[\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-times22.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-eval22.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-sqrt19.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-times26.1%

      \[\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-eval26.1%

      \[\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-sqrt36.5%

      \[\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. +-commutative36.5%

      \[\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-pow36.5%

      \[\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-pow236.5%

      \[\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-eval36.5%

      \[\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/236.5%

      \[\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-flip36.5%

      \[\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. +-commutative36.5%

      \[\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-eval36.5%

      \[\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-rr36.5%

    \[\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 82.9%

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

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

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

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

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

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

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

Alternative 6: 82.2% accurate, 1.8× speedup?

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

\\
\frac{\frac{\frac{1}{x}}{1 + x}}{\sqrt{\frac{1}{x}} \cdot 2}
\end{array}
Derivation
  1. Initial program 36.4%

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

      \[\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-inv36.4%

      \[\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-times22.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-eval22.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-sqrt19.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-times26.1%

      \[\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-eval26.1%

      \[\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-sqrt36.5%

      \[\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. +-commutative36.5%

      \[\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-pow36.5%

      \[\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-pow236.5%

      \[\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-eval36.5%

      \[\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/236.5%

      \[\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-flip36.5%

      \[\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. +-commutative36.5%

      \[\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-eval36.5%

      \[\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-rr36.5%

    \[\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. Step-by-step derivation
    1. *-commutative36.5%

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

      \[\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)}} \]
    3. frac-times38.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)}} \]
    4. *-un-lft-identity38.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)} \]
    5. *-un-lft-identity38.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)} \]
    6. *-rgt-identity38.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)} \]
    7. distribute-lft-in38.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  8. Simplified85.4%

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  9. Taylor expanded in x around inf 83.1%

    \[\leadsto \frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{\color{blue}{2 \cdot \sqrt{\frac{1}{x}}}} \]
  10. Step-by-step derivation
    1. metadata-eval85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{1 + x}}}{2 \cdot \sqrt{\frac{1}{x}}} \]
  14. Final simplification83.7%

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

Alternative 7: 37.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{1}{x + {x}^{0.5}}\\

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 10.5%

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

        \[\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-inv10.5%

        \[\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-times10.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-eval10.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-sqrt10.5%

        \[\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-times10.8%

        \[\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-eval10.8%

        \[\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-sqrt10.8%

        \[\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. +-commutative10.8%

        \[\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-pow10.8%

        \[\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-pow210.8%

        \[\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-eval10.8%

        \[\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/210.8%

        \[\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-flip10.8%

        \[\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. +-commutative10.8%

        \[\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-eval10.8%

        \[\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-rr10.8%

      \[\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 0 8.4%

      \[\leadsto \color{blue}{\frac{1}{x \cdot \left(1 + {x}^{-0.5}\right)}} \]
    6. Step-by-step derivation
      1. distribute-rgt-in8.4%

        \[\leadsto \frac{1}{\color{blue}{1 \cdot x + {x}^{-0.5} \cdot x}} \]
      2. *-lft-identity8.4%

        \[\leadsto \frac{1}{\color{blue}{x} + {x}^{-0.5} \cdot x} \]
      3. pow-plus8.4%

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

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

      \[\leadsto \color{blue}{\frac{1}{x + {x}^{0.5}}} \]

    if 4.6000000000000003e153 < x

    1. Initial program 67.6%

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

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification35.2%

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

Alternative 8: 81.0% accurate, 1.9× speedup?

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

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

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

      \[\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-inv36.4%

      \[\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-times22.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-eval22.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-sqrt19.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-times26.1%

      \[\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-eval26.1%

      \[\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-sqrt36.5%

      \[\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. +-commutative36.5%

      \[\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-pow36.5%

      \[\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-pow236.5%

      \[\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-eval36.5%

      \[\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/236.5%

      \[\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-flip36.5%

      \[\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. +-commutative36.5%

      \[\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-eval36.5%

      \[\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-rr36.5%

    \[\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 35.2%

    \[\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. frac-2neg35.2%

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

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

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

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

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

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

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

Alternative 9: 35.5% accurate, 209.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x) :precision binary64 0.0)
double code(double x) {
	return 0.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 0.0d0
end function
public static double code(double x) {
	return 0.0;
}
def code(x):
	return 0.0
function code(x)
	return 0.0
end
function tmp = code(x)
	tmp = 0.0;
end
code[x_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 36.4%

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

    \[\leadsto \color{blue}{0} \]
  4. Final simplification33.0%

    \[\leadsto 0 \]
  5. Add Preprocessing

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

  :herbie-target
  (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))

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