2isqrt (example 3.6)

Percentage Accurate: 38.6% → 99.2%
Time: 9.4s
Alternatives: 5
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 5 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 38.6% 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.2% accurate, 1.7× speedup?

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

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

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    3. *-un-lft-identity40.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(0.5 + \frac{0.0625}{{x}^{2}}\right) - \left(\frac{0.125}{x} + \frac{\color{blue}{0.0390625}}{{x}^{3}}\right)}{x} \cdot {\left(1 + x\right)}^{-0.5} \]
  9. Simplified98.6%

    \[\leadsto \color{blue}{\frac{\left(0.5 + \frac{0.0625}{{x}^{2}}\right) - \left(\frac{0.125}{x} + \frac{0.0390625}{{x}^{3}}\right)}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  10. Taylor expanded in x around -inf 98.6%

    \[\leadsto \frac{\color{blue}{0.5 + -1 \cdot \frac{0.125 + -1 \cdot \frac{0.0625 - 0.0390625 \cdot \frac{1}{x}}{x}}{x}}}{x} \cdot {\left(1 + x\right)}^{-0.5} \]
  11. Step-by-step derivation
    1. mul-1-neg98.6%

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

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

      \[\leadsto \frac{0.5 - \frac{0.125 + \color{blue}{\left(-\frac{0.0625 - 0.0390625 \cdot \frac{1}{x}}{x}\right)}}{x}}{x} \cdot {\left(1 + x\right)}^{-0.5} \]
    4. unsub-neg98.6%

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

      \[\leadsto \frac{0.5 - \frac{0.125 - \frac{\color{blue}{0.0625 + \left(-0.0390625 \cdot \frac{1}{x}\right)}}{x}}{x}}{x} \cdot {\left(1 + x\right)}^{-0.5} \]
    6. associate-*r/98.6%

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

      \[\leadsto \frac{0.5 - \frac{0.125 - \frac{0.0625 + \left(-\frac{\color{blue}{0.0390625}}{x}\right)}{x}}{x}}{x} \cdot {\left(1 + x\right)}^{-0.5} \]
    8. distribute-neg-frac98.6%

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

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

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

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

Alternative 2: 99.0% accurate, 1.8× speedup?

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

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

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    3. *-un-lft-identity40.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(0.5 + \frac{0.0625}{{x}^{2}}\right) - \left(\frac{0.125}{x} + \frac{\color{blue}{0.0390625}}{{x}^{3}}\right)}{x} \cdot {\left(1 + x\right)}^{-0.5} \]
  9. Simplified98.6%

    \[\leadsto \color{blue}{\frac{\left(0.5 + \frac{0.0625}{{x}^{2}}\right) - \left(\frac{0.125}{x} + \frac{0.0390625}{{x}^{3}}\right)}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  10. Taylor expanded in x around -inf 98.4%

    \[\leadsto \frac{\color{blue}{0.5 + -1 \cdot \frac{0.125 - 0.0625 \cdot \frac{1}{x}}{x}}}{x} \cdot {\left(1 + x\right)}^{-0.5} \]
  11. Step-by-step derivation
    1. mul-1-neg98.4%

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

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

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

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

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

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

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

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

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

Alternative 3: 98.6% 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 40.7%

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    3. *-un-lft-identity40.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\frac{\sqrt{1 + x}}{\sqrt{x}} + -1\right) \cdot {\left(1 + x\right)}^{-0.5}} \]
  7. 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} \]
  8. 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} \]
  9. Simplified98.0%

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

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

Alternative 4: 97.8% 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 40.7%

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    3. *-un-lft-identity40.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(0.5 + \frac{0.0625}{{x}^{2}}\right) - \left(\frac{0.125}{x} + \frac{\color{blue}{0.0390625}}{{x}^{3}}\right)}{x} \cdot {\left(1 + x\right)}^{-0.5} \]
  9. Simplified98.6%

    \[\leadsto \color{blue}{\frac{\left(0.5 + \frac{0.0625}{{x}^{2}}\right) - \left(\frac{0.125}{x} + \frac{0.0390625}{{x}^{3}}\right)}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  10. Taylor expanded in x around inf 69.4%

    \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
  11. Step-by-step derivation
    1. exp-to-pow66.7%

      \[\leadsto 0.5 \cdot \sqrt{\frac{1}{\color{blue}{e^{\log x \cdot 3}}}} \]
    2. *-commutative66.7%

      \[\leadsto 0.5 \cdot \sqrt{\frac{1}{e^{\color{blue}{3 \cdot \log x}}}} \]
    3. exp-neg67.1%

      \[\leadsto 0.5 \cdot \sqrt{\color{blue}{e^{-3 \cdot \log x}}} \]
    4. distribute-lft-neg-in67.1%

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

      \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{-3} \cdot \log x}} \]
    6. *-commutative67.1%

      \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{\log x \cdot -3}}} \]
    7. exp-to-pow69.8%

      \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
    8. metadata-eval69.8%

      \[\leadsto 0.5 \cdot \sqrt{{x}^{\color{blue}{\left(2 \cdot -1.5\right)}}} \]
    9. pow-sqr69.9%

      \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
    10. rem-sqrt-square97.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left|{x}^{-1.5}\right|} \]
    11. metadata-eval97.4%

      \[\leadsto 0.5 \cdot \left|{x}^{\color{blue}{\left(2 \cdot -0.75\right)}}\right| \]
    12. pow-sqr96.9%

      \[\leadsto 0.5 \cdot \left|\color{blue}{{x}^{-0.75} \cdot {x}^{-0.75}}\right| \]
    13. fabs-sqr96.9%

      \[\leadsto 0.5 \cdot \color{blue}{\left({x}^{-0.75} \cdot {x}^{-0.75}\right)} \]
    14. pow-sqr97.4%

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

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

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

Alternative 5: 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 40.7%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  6. Step-by-step derivation
    1. unpow1/25.7%

      \[\leadsto \color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \]
    2. exp-to-pow5.7%

      \[\leadsto \color{blue}{e^{\log \left(\frac{1}{x}\right) \cdot 0.5}} \]
    3. log-rec5.7%

      \[\leadsto e^{\color{blue}{\left(-\log x\right)} \cdot 0.5} \]
    4. distribute-lft-neg-out5.7%

      \[\leadsto e^{\color{blue}{-\log x \cdot 0.5}} \]
    5. distribute-rgt-neg-in5.7%

      \[\leadsto e^{\color{blue}{\log x \cdot \left(-0.5\right)}} \]
    6. metadata-eval5.7%

      \[\leadsto e^{\log x \cdot \color{blue}{-0.5}} \]
    7. exp-to-pow5.7%

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

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

Developer Target 1: 98.4% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024132 
(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)))))