2isqrt (example 3.6)

Percentage Accurate: 38.1% → 99.5%
Time: 9.5s
Alternatives: 12
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 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.1% 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.7× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. flip--34.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. add-sqr-sqrt26.1%

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

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

    \[\leadsto \frac{\frac{\color{blue}{\frac{\left(1 + x\right) - x}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Step-by-step derivation
    1. associate--l+99.1%

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

      \[\leadsto \frac{\frac{\frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. metadata-eval99.1%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative99.1%

      \[\leadsto \frac{\frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Simplified99.1%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  9. Step-by-step derivation
    1. div-inv99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}} \cdot \frac{1}{\sqrt{1 + x}}} \]
    2. pow1/299.0%

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\frac{\frac{1}{x + t\_0 \cdot \sqrt{x}}}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 34.2%

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. flip--34.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. add-sqr-sqrt26.1%

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

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

    \[\leadsto \frac{\frac{\color{blue}{\frac{\left(1 + x\right) - x}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Step-by-step derivation
    1. associate--l+99.1%

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

      \[\leadsto \frac{\frac{\frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. metadata-eval99.1%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative99.1%

      \[\leadsto \frac{\frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Simplified99.1%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  9. Step-by-step derivation
    1. associate-/l/99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x} \cdot \sqrt{x}}} \]
    2. add-sqr-sqrt98.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{\sqrt{x} + \sqrt{1 + x}}} \cdot \sqrt{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}}{\sqrt{1 + x} \cdot \sqrt{x}} \]
    3. times-frac99.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(\sqrt{x} + \sqrt{1 + x}\right)}^{\color{blue}{-1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    5. unpow-199.1%

      \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    6. associate-/l/99.0%

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} \cdot \sqrt{x} + \sqrt{1 + x} \cdot \sqrt{x}}}}{\sqrt{1 + x}} \]
    8. rem-square-sqrt99.3%

      \[\leadsto \frac{\frac{1}{\color{blue}{x} + \sqrt{1 + x} \cdot \sqrt{x}}}{\sqrt{1 + x}} \]
  12. Simplified99.3%

    \[\leadsto \color{blue}{\frac{\frac{1}{x + \sqrt{1 + x} \cdot \sqrt{x}}}{\sqrt{1 + x}}} \]
  13. Final simplification99.3%

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

Alternative 3: 99.1% accurate, 1.7× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. flip--34.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. add-sqr-sqrt26.1%

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

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

    \[\leadsto \frac{\frac{\color{blue}{\frac{\left(1 + x\right) - x}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Step-by-step derivation
    1. associate--l+99.1%

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

      \[\leadsto \frac{\frac{\frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. metadata-eval99.1%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative99.1%

      \[\leadsto \frac{\frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Simplified99.1%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  9. Step-by-step derivation
    1. div-inv99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}} \cdot \frac{1}{\sqrt{1 + x}}} \]
    2. pow1/299.0%

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{x + \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{0.5 + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}}{x} + {\left(\sqrt{-1}\right)}^{2}\right)\right)}} \cdot {\left(1 + x\right)}^{-0.5} \]
  14. Step-by-step derivation
    1. mul-1-neg0.0%

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

      \[\leadsto \frac{1}{x + \left(-\color{blue}{\left(-1 \cdot \frac{0.5 + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}}{x} + {\left(\sqrt{-1}\right)}^{2}\right) \cdot x}\right)} \cdot {\left(1 + x\right)}^{-0.5} \]
    3. distribute-rgt-neg-in0.0%

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

    \[\leadsto \frac{1}{x + \color{blue}{\left(-1 - \frac{0.5 - \frac{0.125}{x}}{x}\right) \cdot \left(-x\right)}} \cdot {\left(1 + x\right)}^{-0.5} \]
  16. Final simplification98.5%

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

Alternative 4: 99.1% accurate, 1.8× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. flip--34.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. add-sqr-sqrt26.1%

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

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

    \[\leadsto \frac{\frac{\color{blue}{\frac{\left(1 + x\right) - x}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Step-by-step derivation
    1. associate--l+99.1%

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

      \[\leadsto \frac{\frac{\frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. metadata-eval99.1%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative99.1%

      \[\leadsto \frac{\frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Simplified99.1%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  9. Step-by-step derivation
    1. associate-/l/99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x} \cdot \sqrt{x}}} \]
    2. add-sqr-sqrt98.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{\sqrt{x} + \sqrt{1 + x}}} \cdot \sqrt{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}}{\sqrt{1 + x} \cdot \sqrt{x}} \]
    3. times-frac99.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(\sqrt{x} + \sqrt{1 + x}\right)}^{\color{blue}{-1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    5. unpow-199.1%

      \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    6. associate-/l/99.0%

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} \cdot \sqrt{x} + \sqrt{1 + x} \cdot \sqrt{x}}}}{\sqrt{1 + x}} \]
    8. rem-square-sqrt99.3%

      \[\leadsto \frac{\frac{1}{\color{blue}{x} + \sqrt{1 + x} \cdot \sqrt{x}}}{\sqrt{1 + x}} \]
  12. Simplified99.3%

    \[\leadsto \color{blue}{\frac{\frac{1}{x + \sqrt{1 + x} \cdot \sqrt{x}}}{\sqrt{1 + x}}} \]
  13. Taylor expanded in x around -inf 0.0%

    \[\leadsto \frac{\frac{1}{x + \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{0.5 + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}}{x} + {\left(\sqrt{-1}\right)}^{2}\right)\right)}}}{\sqrt{1 + x}} \]
  14. Step-by-step derivation
    1. mul-1-neg0.0%

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

      \[\leadsto \frac{1}{x + \left(-\color{blue}{\left(-1 \cdot \frac{0.5 + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}}{x} + {\left(\sqrt{-1}\right)}^{2}\right) \cdot x}\right)} \cdot {\left(1 + x\right)}^{-0.5} \]
    3. distribute-rgt-neg-in0.0%

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

    \[\leadsto \frac{\frac{1}{x + \color{blue}{\left(-1 - \frac{0.5 - \frac{0.125}{x}}{x}\right) \cdot \left(-x\right)}}}{\sqrt{1 + x}} \]
  16. Final simplification98.5%

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

Alternative 5: 99.1% accurate, 1.8× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. flip--34.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. add-sqr-sqrt26.1%

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

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

    \[\leadsto \frac{\frac{\color{blue}{\frac{\left(1 + x\right) - x}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Step-by-step derivation
    1. associate--l+99.1%

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

      \[\leadsto \frac{\frac{\frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. metadata-eval99.1%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative99.1%

      \[\leadsto \frac{\frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Simplified99.1%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  9. Step-by-step derivation
    1. div-inv99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}} \cdot \frac{1}{\sqrt{1 + x}}} \]
    2. pow1/299.0%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.125 \cdot \frac{1}{{\left(\sqrt{-1}\right)}^{2} \cdot {\left({\left(\sqrt{-1}\right)}^{2} - 1\right)}^{2}} + 0.25 \cdot \frac{1}{{\left({\left(\sqrt{-1}\right)}^{2} - 1\right)}^{3}}}{x} - 0.5 \cdot \frac{1}{{\left({\left(\sqrt{-1}\right)}^{2} - 1\right)}^{2}}}{x} + \frac{1}{{\left(\sqrt{-1}\right)}^{2} - 1}}{x}\right)} \cdot {\left(1 + x\right)}^{-0.5} \]
  14. Simplified98.5%

    \[\leadsto \color{blue}{\frac{-0.5 - \frac{\frac{0.0625}{x} + -0.125}{x}}{-x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  15. Final simplification98.5%

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

Alternative 6: 99.1% accurate, 1.8× speedup?

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

\\
\frac{\frac{0.5 - \frac{0.125 - \frac{0.0625}{x}}{x}}{x}}{\sqrt{x + 1}}
\end{array}
Derivation
  1. Initial program 34.2%

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Taylor expanded in x around inf 98.5%

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\left(0.5 + \frac{0.0625}{{x}^{2}}\right) - \frac{0.125}{x}}{x}}}{\sqrt{1 + x}} \]
  8. Taylor expanded in x around -inf 98.5%

    \[\leadsto \frac{\frac{\color{blue}{0.5 + -1 \cdot \frac{0.125 - 0.0625 \cdot \frac{1}{x}}{x}}}{x}}{\sqrt{1 + x}} \]
  9. Step-by-step derivation
    1. mul-1-neg98.5%

      \[\leadsto \frac{\frac{0.5 + \color{blue}{\left(-\frac{0.125 - 0.0625 \cdot \frac{1}{x}}{x}\right)}}{x}}{\sqrt{1 + x}} \]
    2. unsub-neg98.5%

      \[\leadsto \frac{\frac{\color{blue}{0.5 - \frac{0.125 - 0.0625 \cdot \frac{1}{x}}{x}}}{x}}{\sqrt{1 + x}} \]
    3. associate-*r/98.5%

      \[\leadsto \frac{\frac{0.5 - \frac{0.125 - \color{blue}{\frac{0.0625 \cdot 1}{x}}}{x}}{x}}{\sqrt{1 + x}} \]
    4. metadata-eval98.5%

      \[\leadsto \frac{\frac{0.5 - \frac{0.125 - \frac{\color{blue}{0.0625}}{x}}{x}}{x}}{\sqrt{1 + x}} \]
  10. Simplified98.5%

    \[\leadsto \frac{\frac{\color{blue}{0.5 - \frac{0.125 - \frac{0.0625}{x}}{x}}}{x}}{\sqrt{1 + x}} \]
  11. Final simplification98.5%

    \[\leadsto \frac{\frac{0.5 - \frac{0.125 - \frac{0.0625}{x}}{x}}{x}}{\sqrt{x + 1}} \]
  12. Add Preprocessing

Alternative 7: 98.8% accurate, 1.8× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. flip--34.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. add-sqr-sqrt26.1%

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

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

    \[\leadsto \frac{\frac{\color{blue}{\frac{\left(1 + x\right) - x}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Step-by-step derivation
    1. associate--l+99.1%

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

      \[\leadsto \frac{\frac{\frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. metadata-eval99.1%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative99.1%

      \[\leadsto \frac{\frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Simplified99.1%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  9. Step-by-step derivation
    1. div-inv99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}} \cdot \frac{1}{\sqrt{1 + x}}} \]
    2. pow1/299.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 98.8% accurate, 1.8× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. flip--34.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. add-sqr-sqrt26.1%

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

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

    \[\leadsto \frac{\frac{\color{blue}{\frac{\left(1 + x\right) - x}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Step-by-step derivation
    1. associate--l+99.1%

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

      \[\leadsto \frac{\frac{\frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. metadata-eval99.1%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative99.1%

      \[\leadsto \frac{\frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Simplified99.1%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  9. Step-by-step derivation
    1. associate-/l/99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x} \cdot \sqrt{x}}} \]
    2. add-sqr-sqrt98.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{\sqrt{x} + \sqrt{1 + x}}} \cdot \sqrt{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}}{\sqrt{1 + x} \cdot \sqrt{x}} \]
    3. times-frac99.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(\sqrt{x} + \sqrt{1 + x}\right)}^{\color{blue}{-1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    5. unpow-199.1%

      \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    6. associate-/l/99.0%

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} \cdot \sqrt{x} + \sqrt{1 + x} \cdot \sqrt{x}}}}{\sqrt{1 + x}} \]
    8. rem-square-sqrt99.3%

      \[\leadsto \frac{\frac{1}{\color{blue}{x} + \sqrt{1 + x} \cdot \sqrt{x}}}{\sqrt{1 + x}} \]
  12. Simplified99.3%

    \[\leadsto \color{blue}{\frac{\frac{1}{x + \sqrt{1 + x} \cdot \sqrt{x}}}{\sqrt{1 + x}}} \]
  13. Taylor expanded in x around inf 98.0%

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

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

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

    \[\leadsto \frac{\frac{1}{\color{blue}{x \cdot \left(2 + \frac{0.5}{x}\right)}}}{\sqrt{1 + x}} \]
  16. Final simplification98.0%

    \[\leadsto \frac{\frac{1}{x \cdot \left(2 + \frac{0.5}{x}\right)}}{\sqrt{x + 1}} \]
  17. Add Preprocessing

Alternative 9: 98.8% accurate, 1.9× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. flip--34.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. add-sqr-sqrt26.1%

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

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

    \[\leadsto \frac{\frac{\color{blue}{\frac{\left(1 + x\right) - x}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Step-by-step derivation
    1. associate--l+99.1%

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

      \[\leadsto \frac{\frac{\frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. metadata-eval99.1%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative99.1%

      \[\leadsto \frac{\frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Simplified99.1%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  9. Step-by-step derivation
    1. div-inv99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}} \cdot \frac{1}{\sqrt{1 + x}}} \]
    2. pow1/299.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 98.8% accurate, 1.9× speedup?

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

\\
\frac{\frac{0.5 - \frac{0.125}{x}}{x}}{\sqrt{x + 1}}
\end{array}
Derivation
  1. Initial program 34.2%

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*34.3%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. *-rgt-identity34.3%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr34.3%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  5. Taylor expanded in x around inf 97.9%

    \[\leadsto \frac{\color{blue}{\frac{0.5 - 0.125 \cdot \frac{1}{x}}{x}}}{\sqrt{1 + x}} \]
  6. Step-by-step derivation
    1. associate-*r/97.9%

      \[\leadsto \frac{\frac{0.5 - \color{blue}{\frac{0.125 \cdot 1}{x}}}{x}}{\sqrt{1 + x}} \]
    2. metadata-eval97.9%

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

    \[\leadsto \frac{\color{blue}{\frac{0.5 - \frac{0.125}{x}}{x}}}{\sqrt{1 + x}} \]
  8. Final simplification97.9%

    \[\leadsto \frac{\frac{0.5 - \frac{0.125}{x}}{x}}{\sqrt{x + 1}} \]
  9. Add Preprocessing

Alternative 11: 98.1% accurate, 2.0× speedup?

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

\\
0.5 \cdot {x}^{-1.5}
\end{array}
Derivation
  1. Initial program 34.2%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt20.8%

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

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

      \[\leadsto \frac{1}{\sqrt{x}} - \sqrt{\color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}} \]
    4. metadata-eval30.5%

      \[\leadsto \frac{1}{\sqrt{x}} - \sqrt{\frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}} \]
    5. add-sqr-sqrt26.4%

      \[\leadsto \frac{1}{\sqrt{x}} - \sqrt{\frac{1}{\color{blue}{x + 1}}} \]
    6. +-commutative26.4%

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

    \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{\sqrt{\frac{1}{1 + x}}} \]
  5. Taylor expanded in x around inf 58.7%

    \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
  6. Step-by-step derivation
    1. *-commutative58.7%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{x}^{-1.5}} \cdot 0.5 \]
  12. Final simplification97.1%

    \[\leadsto 0.5 \cdot {x}^{-1.5} \]
  13. Add Preprocessing

Alternative 12: 5.6% accurate, 2.0× speedup?

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  4. Step-by-step derivation
    1. *-un-lft-identity5.7%

      \[\leadsto \color{blue}{1 \cdot \sqrt{\frac{1}{x}}} \]
    2. inv-pow5.7%

      \[\leadsto 1 \cdot \sqrt{\color{blue}{{x}^{-1}}} \]
    3. sqrt-pow15.7%

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

      \[\leadsto 1 \cdot {x}^{\color{blue}{-0.5}} \]
  5. Applied egg-rr5.7%

    \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} \]
  6. Step-by-step derivation
    1. *-lft-identity5.7%

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

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

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

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

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