pow(sqrt(x + 1) - sqrt(x),2)

Percentage Accurate: 99.1% → 99.8%
Time: 4.2s
Alternatives: 10
Speedup: 2.0×

Specification

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

\\
{\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2}
\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 10 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: 99.1% accurate, 1.0× speedup?

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

\\
{\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2}
\end{array}

Alternative 1: 99.8% accurate, 0.5× speedup?

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

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

    \[{\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2} \]
  2. Add Preprocessing
  3. Applied rewrites99.9%

    \[\leadsto {\color{blue}{\left(\frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(1 + x\right)}^{1.5}\right)} \cdot \left(\left(\left(1 + x\right) + x\right) - \mathsf{hypot}\left(\sqrt{x}, x\right)\right)\right)}}^{2} \]
  4. Step-by-step derivation
    1. lift-hypot.f64N/A

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

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

      \[\leadsto {\left(\frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(1 + x\right)}^{\frac{3}{2}}\right)} \cdot \left(\left(\left(1 + x\right) + x\right) - \sqrt{\color{blue}{\sqrt{x}} \cdot \sqrt{x} + x \cdot x}\right)\right)}^{2} \]
    4. lift-sqrt.f64N/A

      \[\leadsto {\left(\frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(1 + x\right)}^{\frac{3}{2}}\right)} \cdot \left(\left(\left(1 + x\right) + x\right) - \sqrt{\sqrt{x} \cdot \color{blue}{\sqrt{x}} + x \cdot x}\right)\right)}^{2} \]
    5. rem-square-sqrtN/A

      \[\leadsto {\left(\frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(1 + x\right)}^{\frac{3}{2}}\right)} \cdot \left(\left(\left(1 + x\right) + x\right) - \sqrt{\color{blue}{x} + x \cdot x}\right)\right)}^{2} \]
    6. distribute-rgt1-inN/A

      \[\leadsto {\left(\frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(1 + x\right)}^{\frac{3}{2}}\right)} \cdot \left(\left(\left(1 + x\right) + x\right) - \sqrt{\color{blue}{\left(x + 1\right) \cdot x}}\right)\right)}^{2} \]
    7. distribute-lft1-inN/A

      \[\leadsto {\left(\frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(1 + x\right)}^{\frac{3}{2}}\right)} \cdot \left(\left(\left(1 + x\right) + x\right) - \sqrt{\color{blue}{x \cdot x + x}}\right)\right)}^{2} \]
    8. lower-fma.f6499.9

      \[\leadsto {\left(\frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(1 + x\right)}^{1.5}\right)} \cdot \left(\left(\left(1 + x\right) + x\right) - \sqrt{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}\right)\right)}^{2} \]
  5. Applied rewrites99.9%

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

Alternative 2: 99.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{x + 1} + \sqrt{x}\\ {\left(t\_0 \cdot t\_0\right)}^{-1} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ (sqrt (+ x 1.0)) (sqrt x)))) (pow (* t_0 t_0) -1.0)))
double code(double x) {
	double t_0 = sqrt((x + 1.0)) + sqrt(x);
	return pow((t_0 * t_0), -1.0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = sqrt((x + 1.0d0)) + sqrt(x)
    code = (t_0 * t_0) ** (-1.0d0)
end function
public static double code(double x) {
	double t_0 = Math.sqrt((x + 1.0)) + Math.sqrt(x);
	return Math.pow((t_0 * t_0), -1.0);
}
def code(x):
	t_0 = math.sqrt((x + 1.0)) + math.sqrt(x)
	return math.pow((t_0 * t_0), -1.0)
function code(x)
	t_0 = Float64(sqrt(Float64(x + 1.0)) + sqrt(x))
	return Float64(t_0 * t_0) ^ -1.0
end
function tmp = code(x)
	t_0 = sqrt((x + 1.0)) + sqrt(x);
	tmp = (t_0 * t_0) ^ -1.0;
end
code[x_] := Block[{t$95$0 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], -1.0], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{x + 1} + \sqrt{x}\\
{\left(t\_0 \cdot t\_0\right)}^{-1}
\end{array}
\end{array}
Derivation
  1. Initial program 99.2%

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

      \[\leadsto \color{blue}{{\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2}} \]
    2. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{x + 1} + \sqrt{x}\right) \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}} \]
  7. Final simplification99.8%

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

Alternative 3: 98.2% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_0 := 1 - \sqrt{x}\\
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.01:\\
\;\;\;\;\frac{0.25 + \frac{\frac{0.078125}{x} - 0.125}{x}}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(t\_0 + x\right) \cdot t\_0\\


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

    1. Initial program 67.0%

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

      \[\leadsto \color{blue}{\frac{\left(\frac{1}{4} \cdot x + \left(\frac{\frac{1}{64}}{x} + \frac{\frac{1}{16}}{x}\right)\right) - \frac{1}{8}}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\frac{1}{4} \cdot x + \left(\frac{\frac{1}{64}}{x} + \frac{\frac{1}{16}}{x}\right)\right) - \frac{1}{8}}{{x}^{2}}} \]
      2. associate-+r+N/A

        \[\leadsto \frac{\color{blue}{\left(\left(\frac{1}{4} \cdot x + \frac{\frac{1}{64}}{x}\right) + \frac{\frac{1}{16}}{x}\right)} - \frac{1}{8}}{{x}^{2}} \]
      3. associate--l+N/A

        \[\leadsto \frac{\color{blue}{\left(\frac{1}{4} \cdot x + \frac{\frac{1}{64}}{x}\right) + \left(\frac{\frac{1}{16}}{x} - \frac{1}{8}\right)}}{{x}^{2}} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(\frac{\frac{1}{16}}{x} - \frac{1}{8}\right) + \left(\frac{1}{4} \cdot x + \frac{\frac{1}{64}}{x}\right)}}{{x}^{2}} \]
      5. associate-+l-N/A

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{16}}{x} - \left(\frac{1}{8} - \left(\frac{1}{4} \cdot x + \frac{\frac{1}{64}}{x}\right)\right)}}{{x}^{2}} \]
      6. lower--.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{16}}{x} - \left(\frac{1}{8} - \left(\frac{1}{4} \cdot x + \frac{\frac{1}{64}}{x}\right)\right)}}{{x}^{2}} \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{16}}{x}} - \left(\frac{1}{8} - \left(\frac{1}{4} \cdot x + \frac{\frac{1}{64}}{x}\right)\right)}{{x}^{2}} \]
      8. lower--.f64N/A

        \[\leadsto \frac{\frac{\frac{1}{16}}{x} - \color{blue}{\left(\frac{1}{8} - \left(\frac{1}{4} \cdot x + \frac{\frac{1}{64}}{x}\right)\right)}}{{x}^{2}} \]
      9. lower-fma.f64N/A

        \[\leadsto \frac{\frac{\frac{1}{16}}{x} - \left(\frac{1}{8} - \color{blue}{\mathsf{fma}\left(\frac{1}{4}, x, \frac{\frac{1}{64}}{x}\right)}\right)}{{x}^{2}} \]
      10. lower-/.f64N/A

        \[\leadsto \frac{\frac{\frac{1}{16}}{x} - \left(\frac{1}{8} - \mathsf{fma}\left(\frac{1}{4}, x, \color{blue}{\frac{\frac{1}{64}}{x}}\right)\right)}{{x}^{2}} \]
      11. unpow2N/A

        \[\leadsto \frac{\frac{\frac{1}{16}}{x} - \left(\frac{1}{8} - \mathsf{fma}\left(\frac{1}{4}, x, \frac{\frac{1}{64}}{x}\right)\right)}{\color{blue}{x \cdot x}} \]
      12. lower-*.f6496.0

        \[\leadsto \frac{\frac{0.0625}{x} - \left(0.125 - \mathsf{fma}\left(0.25, x, \frac{0.015625}{x}\right)\right)}{\color{blue}{x \cdot x}} \]
    5. Applied rewrites96.0%

      \[\leadsto \color{blue}{\frac{\frac{0.0625}{x} - \left(0.125 - \mathsf{fma}\left(0.25, x, \frac{0.015625}{x}\right)\right)}{x \cdot x}} \]
    6. Taylor expanded in x around inf

      \[\leadsto \frac{\left(\frac{1}{4} + \frac{\frac{5}{64}}{{x}^{2}}\right) - \frac{1}{8} \cdot \frac{1}{x}}{\color{blue}{x}} \]
    7. Step-by-step derivation
      1. Applied rewrites96.0%

        \[\leadsto \frac{0.25 + \frac{\frac{0.078125}{x} - 0.125}{x}}{\color{blue}{x}} \]

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

      1. Initial program 99.9%

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

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

          \[\leadsto x \cdot \left(1 - \sqrt{x}\right) + \color{blue}{\left(1 - \sqrt{x}\right) \cdot \left(1 - \sqrt{x}\right)} \]
        2. distribute-rgt-outN/A

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

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

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

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

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

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

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

          \[\leadsto \left(\left(1 - \sqrt{x}\right) + x\right) \cdot \color{blue}{\left(1 - \sqrt{x}\right)} \]
        10. lower-sqrt.f6499.1

          \[\leadsto \left(\left(1 - \sqrt{x}\right) + x\right) \cdot \left(1 - \color{blue}{\sqrt{x}}\right) \]
      5. Applied rewrites99.1%

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

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

    Alternative 4: 98.0% accurate, 1.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \sqrt{x}\\ \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.01:\\ \;\;\;\;\frac{0.25 - \frac{0.125}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 + x\right) \cdot t\_0\\ \end{array} \end{array} \]
    (FPCore (x)
     :precision binary64
     (let* ((t_0 (- 1.0 (sqrt x))))
       (if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.01)
         (/ (- 0.25 (/ 0.125 x)) x)
         (* (+ t_0 x) t_0))))
    double code(double x) {
    	double t_0 = 1.0 - sqrt(x);
    	double tmp;
    	if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01) {
    		tmp = (0.25 - (0.125 / x)) / x;
    	} else {
    		tmp = (t_0 + x) * t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        real(8) :: t_0
        real(8) :: tmp
        t_0 = 1.0d0 - sqrt(x)
        if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.01d0) then
            tmp = (0.25d0 - (0.125d0 / x)) / x
        else
            tmp = (t_0 + x) * t_0
        end if
        code = tmp
    end function
    
    public static double code(double x) {
    	double t_0 = 1.0 - Math.sqrt(x);
    	double tmp;
    	if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.01) {
    		tmp = (0.25 - (0.125 / x)) / x;
    	} else {
    		tmp = (t_0 + x) * t_0;
    	}
    	return tmp;
    }
    
    def code(x):
    	t_0 = 1.0 - math.sqrt(x)
    	tmp = 0
    	if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.01:
    		tmp = (0.25 - (0.125 / x)) / x
    	else:
    		tmp = (t_0 + x) * t_0
    	return tmp
    
    function code(x)
    	t_0 = Float64(1.0 - sqrt(x))
    	tmp = 0.0
    	if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.01)
    		tmp = Float64(Float64(0.25 - Float64(0.125 / x)) / x);
    	else
    		tmp = Float64(Float64(t_0 + x) * t_0);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x)
    	t_0 = 1.0 - sqrt(x);
    	tmp = 0.0;
    	if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01)
    		tmp = (0.25 - (0.125 / x)) / x;
    	else
    		tmp = (t_0 + x) * t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_] := Block[{t$95$0 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.01], N[(N[(0.25 - N[(0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(t$95$0 + x), $MachinePrecision] * t$95$0), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 1 - \sqrt{x}\\
    \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.01:\\
    \;\;\;\;\frac{0.25 - \frac{0.125}{x}}{x}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(t\_0 + x\right) \cdot t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0100000000000000002

      1. Initial program 67.0%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{4} \cdot x - \frac{1}{8}}{{x}^{2}}} \]
      4. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \frac{\frac{1}{4} \cdot x - \frac{1}{8}}{\color{blue}{x \cdot x}} \]
        2. associate-/r*N/A

          \[\leadsto \color{blue}{\frac{\frac{\frac{1}{4} \cdot x - \frac{1}{8}}{x}}{x}} \]
        3. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{\frac{1}{4} \cdot x - \frac{1}{8}}{x}}{x}} \]
        4. div-subN/A

          \[\leadsto \frac{\color{blue}{\frac{\frac{1}{4} \cdot x}{x} - \frac{\frac{1}{8}}{x}}}{x} \]
        5. associate-/l*N/A

          \[\leadsto \frac{\color{blue}{\frac{1}{4} \cdot \frac{x}{x}} - \frac{\frac{1}{8}}{x}}{x} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\frac{1}{4} \cdot \frac{\color{blue}{x \cdot 1}}{x} - \frac{\frac{1}{8}}{x}}{x} \]
        7. associate-*r/N/A

          \[\leadsto \frac{\frac{1}{4} \cdot \color{blue}{\left(x \cdot \frac{1}{x}\right)} - \frac{\frac{1}{8}}{x}}{x} \]
        8. rgt-mult-inverseN/A

          \[\leadsto \frac{\frac{1}{4} \cdot \color{blue}{1} - \frac{\frac{1}{8}}{x}}{x} \]
        9. metadata-evalN/A

          \[\leadsto \frac{\color{blue}{\frac{1}{4}} - \frac{\frac{1}{8}}{x}}{x} \]
        10. lower--.f64N/A

          \[\leadsto \frac{\color{blue}{\frac{1}{4} - \frac{\frac{1}{8}}{x}}}{x} \]
        11. lower-/.f6487.6

          \[\leadsto \frac{0.25 - \color{blue}{\frac{0.125}{x}}}{x} \]
      5. Applied rewrites87.6%

        \[\leadsto \color{blue}{\frac{0.25 - \frac{0.125}{x}}{x}} \]

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

      1. Initial program 99.9%

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

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

          \[\leadsto x \cdot \left(1 - \sqrt{x}\right) + \color{blue}{\left(1 - \sqrt{x}\right) \cdot \left(1 - \sqrt{x}\right)} \]
        2. distribute-rgt-outN/A

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

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

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

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

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

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

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

          \[\leadsto \left(\left(1 - \sqrt{x}\right) + x\right) \cdot \color{blue}{\left(1 - \sqrt{x}\right)} \]
        10. lower-sqrt.f6499.1

          \[\leadsto \left(\left(1 - \sqrt{x}\right) + x\right) \cdot \left(1 - \color{blue}{\sqrt{x}}\right) \]
      5. Applied rewrites99.1%

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

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

    Alternative 5: 99.2% accurate, 2.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{x + 1}\\ \frac{t\_0 - \sqrt{x}}{t\_0 + \sqrt{x}} \end{array} \end{array} \]
    (FPCore (x)
     :precision binary64
     (let* ((t_0 (sqrt (+ x 1.0)))) (/ (- t_0 (sqrt x)) (+ t_0 (sqrt x)))))
    double code(double x) {
    	double t_0 = sqrt((x + 1.0));
    	return (t_0 - sqrt(x)) / (t_0 + sqrt(x));
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        real(8) :: t_0
        t_0 = sqrt((x + 1.0d0))
        code = (t_0 - sqrt(x)) / (t_0 + sqrt(x))
    end function
    
    public static double code(double x) {
    	double t_0 = Math.sqrt((x + 1.0));
    	return (t_0 - Math.sqrt(x)) / (t_0 + Math.sqrt(x));
    }
    
    def code(x):
    	t_0 = math.sqrt((x + 1.0))
    	return (t_0 - math.sqrt(x)) / (t_0 + math.sqrt(x))
    
    function code(x)
    	t_0 = sqrt(Float64(x + 1.0))
    	return Float64(Float64(t_0 - sqrt(x)) / Float64(t_0 + sqrt(x)))
    end
    
    function tmp = code(x)
    	t_0 = sqrt((x + 1.0));
    	tmp = (t_0 - sqrt(x)) / (t_0 + sqrt(x));
    end
    
    code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(t$95$0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \sqrt{x + 1}\\
    \frac{t\_0 - \sqrt{x}}{t\_0 + \sqrt{x}}
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 99.2%

      \[{\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2} \]
    2. Add Preprocessing
    3. Applied rewrites99.9%

      \[\leadsto {\color{blue}{\left(\frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(1 + x\right)}^{1.5}\right)} \cdot \left(\left(\left(1 + x\right) + x\right) - \mathsf{hypot}\left(\sqrt{x}, x\right)\right)\right)}}^{2} \]
    4. Applied rewrites99.3%

      \[\leadsto \color{blue}{\frac{\sqrt{x + 1} - \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} \]
    5. Add Preprocessing

    Alternative 6: 96.6% accurate, 2.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.01:\\ \;\;\;\;\frac{0.25 - \frac{0.125}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;1 - 2 \cdot \sqrt{x}\\ \end{array} \end{array} \]
    (FPCore (x)
     :precision binary64
     (if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.01)
       (/ (- 0.25 (/ 0.125 x)) x)
       (- 1.0 (* 2.0 (sqrt x)))))
    double code(double x) {
    	double tmp;
    	if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01) {
    		tmp = (0.25 - (0.125 / x)) / x;
    	} else {
    		tmp = 1.0 - (2.0 * sqrt(x));
    	}
    	return tmp;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        real(8) :: tmp
        if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.01d0) then
            tmp = (0.25d0 - (0.125d0 / x)) / x
        else
            tmp = 1.0d0 - (2.0d0 * sqrt(x))
        end if
        code = tmp
    end function
    
    public static double code(double x) {
    	double tmp;
    	if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.01) {
    		tmp = (0.25 - (0.125 / x)) / x;
    	} else {
    		tmp = 1.0 - (2.0 * Math.sqrt(x));
    	}
    	return tmp;
    }
    
    def code(x):
    	tmp = 0
    	if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.01:
    		tmp = (0.25 - (0.125 / x)) / x
    	else:
    		tmp = 1.0 - (2.0 * math.sqrt(x))
    	return tmp
    
    function code(x)
    	tmp = 0.0
    	if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.01)
    		tmp = Float64(Float64(0.25 - Float64(0.125 / x)) / x);
    	else
    		tmp = Float64(1.0 - Float64(2.0 * sqrt(x)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x)
    	tmp = 0.0;
    	if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01)
    		tmp = (0.25 - (0.125 / x)) / x;
    	else
    		tmp = 1.0 - (2.0 * sqrt(x));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.01], N[(N[(0.25 - N[(0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(1.0 - N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.01:\\
    \;\;\;\;\frac{0.25 - \frac{0.125}{x}}{x}\\
    
    \mathbf{else}:\\
    \;\;\;\;1 - 2 \cdot \sqrt{x}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0100000000000000002

      1. Initial program 67.0%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{4} \cdot x - \frac{1}{8}}{{x}^{2}}} \]
      4. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \frac{\frac{1}{4} \cdot x - \frac{1}{8}}{\color{blue}{x \cdot x}} \]
        2. associate-/r*N/A

          \[\leadsto \color{blue}{\frac{\frac{\frac{1}{4} \cdot x - \frac{1}{8}}{x}}{x}} \]
        3. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{\frac{1}{4} \cdot x - \frac{1}{8}}{x}}{x}} \]
        4. div-subN/A

          \[\leadsto \frac{\color{blue}{\frac{\frac{1}{4} \cdot x}{x} - \frac{\frac{1}{8}}{x}}}{x} \]
        5. associate-/l*N/A

          \[\leadsto \frac{\color{blue}{\frac{1}{4} \cdot \frac{x}{x}} - \frac{\frac{1}{8}}{x}}{x} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\frac{1}{4} \cdot \frac{\color{blue}{x \cdot 1}}{x} - \frac{\frac{1}{8}}{x}}{x} \]
        7. associate-*r/N/A

          \[\leadsto \frac{\frac{1}{4} \cdot \color{blue}{\left(x \cdot \frac{1}{x}\right)} - \frac{\frac{1}{8}}{x}}{x} \]
        8. rgt-mult-inverseN/A

          \[\leadsto \frac{\frac{1}{4} \cdot \color{blue}{1} - \frac{\frac{1}{8}}{x}}{x} \]
        9. metadata-evalN/A

          \[\leadsto \frac{\color{blue}{\frac{1}{4}} - \frac{\frac{1}{8}}{x}}{x} \]
        10. lower--.f64N/A

          \[\leadsto \frac{\color{blue}{\frac{1}{4} - \frac{\frac{1}{8}}{x}}}{x} \]
        11. lower-/.f6487.6

          \[\leadsto \frac{0.25 - \color{blue}{\frac{0.125}{x}}}{x} \]
      5. Applied rewrites87.6%

        \[\leadsto \color{blue}{\frac{0.25 - \frac{0.125}{x}}{x}} \]

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

      1. Initial program 99.9%

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

          \[\leadsto \color{blue}{{\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2}} \]
        2. unpow2N/A

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

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

          \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \color{blue}{\left(\sqrt{x + 1} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right)\right)} \]
        5. distribute-rgt-inN/A

          \[\leadsto \color{blue}{\sqrt{x + 1} \cdot \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\sqrt{x + 1} - \sqrt{x}\right)} \]
        6. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1}} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\sqrt{x + 1} - \sqrt{x}\right) \]
        7. lift--.f64N/A

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

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

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

          \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \color{blue}{\left(\left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\mathsf{neg}\left(\sqrt{x}\right)\right) + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right)} \]
        11. sqr-negN/A

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

          \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \left(\color{blue}{\sqrt{x}} \cdot \sqrt{x} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right) \]
        13. lift-sqrt.f64N/A

          \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \left(\sqrt{x} \cdot \color{blue}{\sqrt{x}} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right) \]
        14. rem-square-sqrtN/A

          \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \left(\color{blue}{x} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right) \]
        15. cancel-sign-sub-invN/A

          \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \color{blue}{\left(x - \sqrt{x} \cdot \sqrt{x + 1}\right)} \]
        16. rem-square-sqrtN/A

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{1 + x} - \sqrt{x}, \sqrt{1 + x}, x - \mathsf{hypot}\left(\sqrt{x}, x\right)\right)} \]
      5. Taylor expanded in x around 0

        \[\leadsto \color{blue}{1 - 2 \cdot \sqrt{x}} \]
      6. Step-by-step derivation
        1. lower--.f64N/A

          \[\leadsto \color{blue}{1 - 2 \cdot \sqrt{x}} \]
        2. lower-*.f64N/A

          \[\leadsto 1 - \color{blue}{2 \cdot \sqrt{x}} \]
        3. lower-sqrt.f6497.7

          \[\leadsto 1 - 2 \cdot \color{blue}{\sqrt{x}} \]
      7. Applied rewrites97.7%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.01:\\ \;\;\;\;\frac{0.25 - \frac{0.125}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;1 - 2 \cdot \sqrt{x}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 7: 99.1% accurate, 2.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{1 + x} - \sqrt{x}\\ t\_0 \cdot t\_0 \end{array} \end{array} \]
    (FPCore (x)
     :precision binary64
     (let* ((t_0 (- (sqrt (+ 1.0 x)) (sqrt x)))) (* t_0 t_0)))
    double code(double x) {
    	double t_0 = sqrt((1.0 + x)) - sqrt(x);
    	return t_0 * t_0;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        real(8) :: t_0
        t_0 = sqrt((1.0d0 + x)) - sqrt(x)
        code = t_0 * t_0
    end function
    
    public static double code(double x) {
    	double t_0 = Math.sqrt((1.0 + x)) - Math.sqrt(x);
    	return t_0 * t_0;
    }
    
    def code(x):
    	t_0 = math.sqrt((1.0 + x)) - math.sqrt(x)
    	return t_0 * t_0
    
    function code(x)
    	t_0 = Float64(sqrt(Float64(1.0 + x)) - sqrt(x))
    	return Float64(t_0 * t_0)
    end
    
    function tmp = code(x)
    	t_0 = sqrt((1.0 + x)) - sqrt(x);
    	tmp = t_0 * t_0;
    end
    
    code[x_] := Block[{t$95$0 = N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \sqrt{1 + x} - \sqrt{x}\\
    t\_0 \cdot t\_0
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 99.2%

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

        \[\leadsto \color{blue}{{\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2}} \]
      2. unpow2N/A

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \left(\sqrt{x + 1} - \sqrt{x}\right)} \]
      3. lower-*.f6499.2

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

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

        \[\leadsto \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x}\right) \cdot \left(\sqrt{x + 1} - \sqrt{x}\right) \]
      6. lower-+.f6499.2

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

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

        \[\leadsto \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x}\right) \]
      9. lower-+.f6499.2

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

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \left(\sqrt{1 + x} - \sqrt{x}\right)} \]
    5. Add Preprocessing

    Alternative 8: 94.8% accurate, 6.7× speedup?

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

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

        \[\leadsto \color{blue}{{\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2}} \]
      2. unpow2N/A

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

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \color{blue}{\left(\sqrt{x + 1} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right)\right)} \]
      5. distribute-rgt-inN/A

        \[\leadsto \color{blue}{\sqrt{x + 1} \cdot \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\sqrt{x + 1} - \sqrt{x}\right)} \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1}} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\sqrt{x + 1} - \sqrt{x}\right) \]
      7. lift--.f64N/A

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

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

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \color{blue}{\left(\left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\mathsf{neg}\left(\sqrt{x}\right)\right) + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right)} \]
      11. sqr-negN/A

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \left(\color{blue}{\sqrt{x}} \cdot \sqrt{x} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right) \]
      13. lift-sqrt.f64N/A

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \left(\sqrt{x} \cdot \color{blue}{\sqrt{x}} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right) \]
      14. rem-square-sqrtN/A

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \left(\color{blue}{x} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right) \]
      15. cancel-sign-sub-invN/A

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \color{blue}{\left(x - \sqrt{x} \cdot \sqrt{x + 1}\right)} \]
      16. rem-square-sqrtN/A

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{1 + x} - \sqrt{x}, \sqrt{1 + x}, x - \mathsf{hypot}\left(\sqrt{x}, x\right)\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1 - 2 \cdot \sqrt{x}} \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \color{blue}{1 - 2 \cdot \sqrt{x}} \]
      2. lower-*.f64N/A

        \[\leadsto 1 - \color{blue}{2 \cdot \sqrt{x}} \]
      3. lower-sqrt.f6495.8

        \[\leadsto 1 - 2 \cdot \color{blue}{\sqrt{x}} \]
    7. Applied rewrites95.8%

      \[\leadsto \color{blue}{1 - 2 \cdot \sqrt{x}} \]
    8. Add Preprocessing

    Alternative 9: 6.6% accurate, 10.7× speedup?

    \[\begin{array}{l} \\ \frac{0.25}{x} \end{array} \]
    (FPCore (x) :precision binary64 (/ 0.25 x))
    double code(double x) {
    	return 0.25 / x;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        code = 0.25d0 / x
    end function
    
    public static double code(double x) {
    	return 0.25 / x;
    }
    
    def code(x):
    	return 0.25 / x
    
    function code(x)
    	return Float64(0.25 / x)
    end
    
    function tmp = code(x)
    	tmp = 0.25 / x;
    end
    
    code[x_] := N[(0.25 / x), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{0.25}{x}
    \end{array}
    
    Derivation
    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{4}}{x}} \]
    4. Step-by-step derivation
      1. lower-/.f646.3

        \[\leadsto \color{blue}{\frac{0.25}{x}} \]
    5. Applied rewrites6.3%

      \[\leadsto \color{blue}{\frac{0.25}{x}} \]
    6. Final simplification6.3%

      \[\leadsto \frac{0.25}{x} \]
    7. Add Preprocessing

    Alternative 10: 5.8% accurate, 10.7× speedup?

    \[\begin{array}{l} \\ \frac{0.125}{x} \end{array} \]
    (FPCore (x) :precision binary64 (/ 0.125 x))
    double code(double x) {
    	return 0.125 / x;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        code = 0.125d0 / x
    end function
    
    public static double code(double x) {
    	return 0.125 / x;
    }
    
    def code(x):
    	return 0.125 / x
    
    function code(x)
    	return Float64(0.125 / x)
    end
    
    function tmp = code(x)
    	tmp = 0.125 / x;
    end
    
    code[x_] := N[(0.125 / x), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{0.125}{x}
    \end{array}
    
    Derivation
    1. Initial program 99.2%

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

        \[\leadsto \color{blue}{{\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2}} \]
      2. unpow2N/A

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

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \color{blue}{\left(\sqrt{x + 1} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right)\right)} \]
      5. distribute-rgt-inN/A

        \[\leadsto \color{blue}{\sqrt{x + 1} \cdot \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\sqrt{x + 1} - \sqrt{x}\right)} \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1}} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\sqrt{x + 1} - \sqrt{x}\right) \]
      7. lift--.f64N/A

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

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

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \color{blue}{\left(\left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\mathsf{neg}\left(\sqrt{x}\right)\right) + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right)} \]
      11. sqr-negN/A

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \left(\color{blue}{\sqrt{x}} \cdot \sqrt{x} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right) \]
      13. lift-sqrt.f64N/A

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \left(\sqrt{x} \cdot \color{blue}{\sqrt{x}} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right) \]
      14. rem-square-sqrtN/A

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \left(\color{blue}{x} + \left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \sqrt{x + 1}\right) \]
      15. cancel-sign-sub-invN/A

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \sqrt{x + 1} + \color{blue}{\left(x - \sqrt{x} \cdot \sqrt{x + 1}\right)} \]
      16. rem-square-sqrtN/A

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{1 + x} - \sqrt{x}, \sqrt{1 + x}, x - \mathsf{hypot}\left(\sqrt{x}, x\right)\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{\frac{1}{8}}{x}} \]
    6. Step-by-step derivation
      1. lower-/.f645.7

        \[\leadsto \color{blue}{\frac{0.125}{x}} \]
    7. Applied rewrites5.7%

      \[\leadsto \color{blue}{\frac{0.125}{x}} \]
    8. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 1 
    (FPCore (x)
      :name "pow(sqrt(x + 1) - sqrt(x),2)"
      :precision binary64
      :pre (and (<= -1000000000.0 x) (<= x 1000000000.0))
      (pow (- (sqrt (+ x 1.0)) (sqrt x)) 2.0))