2isqrt (example 3.6)

Percentage Accurate: 38.8% → 99.6%
Time: 10.1s
Alternatives: 9
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 9 alternatives:

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

Initial Program: 38.8% 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.6% accurate, 0.5× speedup?

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

\\
\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{x + 1}}
\end{array}
Derivation
  1. Initial program 34.7%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--35.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval80.8%

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  8. Simplified80.8%

    \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity80.8%

      \[\leadsto \color{blue}{1 \cdot \frac{\frac{1}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
    2. associate-/l/80.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(\sqrt{x}, x\right) \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
    3. associate-/r*99.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{1 + x}}} \]
  12. Simplified99.6%

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{1 + x}}} \]
  13. Final simplification99.6%

    \[\leadsto \frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{x + 1}} \]
  14. Add Preprocessing

Alternative 2: 98.7% accurate, 0.9× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  6. Step-by-step derivation
    1. mul-1-neg0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{-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)}} \]
    2. *-commutative0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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 x}} \]
    3. distribute-rgt-neg-in0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  7. Simplified34.5%

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

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

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

Alternative 3: 98.7% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--35.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval80.8%

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  8. Simplified80.8%

    \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity80.8%

      \[\leadsto \color{blue}{1 \cdot \frac{\frac{1}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
    2. associate-/l/80.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(\sqrt{x}, x\right) \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
    3. associate-/r*99.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{1 + x}}} \]
  12. Simplified99.6%

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{1 + x}}} \]
  13. Taylor expanded in x around inf 99.0%

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

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

      \[\leadsto \frac{\frac{1 - \frac{\color{blue}{0.5}}{x}}{x}}{\sqrt{x} + \sqrt{1 + x}} \]
  15. Simplified99.0%

    \[\leadsto \frac{\color{blue}{\frac{1 - \frac{0.5}{x}}{x}}}{\sqrt{x} + \sqrt{1 + x}} \]
  16. Final simplification99.0%

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

Alternative 4: 97.8% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  6. Step-by-step derivation
    1. mul-1-neg0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{-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)}} \]
    2. *-commutative0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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 x}} \]
    3. distribute-rgt-neg-in0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  7. Simplified34.5%

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

    \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}}}{\left(-1 - \frac{0.5 + \frac{-0.125}{x}}{x}\right) \cdot \left(-x\right)} \]
  9. Step-by-step derivation
    1. *-commutative98.5%

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\left(-x\right) \cdot \color{blue}{\left(-1 + \left(-\frac{0.5 + \frac{-0.125}{x}}{x}\right)\right)}} \]
    3. neg-mul-198.5%

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

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

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

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

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

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{x} \cdot -1 + \left(-x\right) \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    10. *-commutative31.8%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{-1 \cdot x} + \left(-x\right) \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    11. neg-mul-131.8%

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

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} + \left(-x\right) \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    14. sqr-neg79.6%

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

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

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

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

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

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    21. add-sqr-sqrt98.4%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \color{blue}{x} \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    22. neg-mul-198.4%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + x \cdot \color{blue}{\left(-\frac{0.5 + \frac{-0.125}{x}}{x}\right)}} \]
    23. distribute-neg-frac298.4%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + x \cdot \color{blue}{\frac{0.5 + \frac{-0.125}{x}}{-x}}} \]
  10. Applied egg-rr98.5%

    \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{x + x \cdot \frac{0.5 + \frac{0.125}{x}}{x}}} \]
  11. Step-by-step derivation
    1. *-commutative98.5%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \color{blue}{\frac{0.5 + \frac{0.125}{x}}{x} \cdot x}} \]
    2. distribute-rgt1-in98.5%

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

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

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

Alternative 5: 97.8% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  6. Step-by-step derivation
    1. mul-1-neg0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{-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)}} \]
    2. *-commutative0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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 x}} \]
    3. distribute-rgt-neg-in0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  7. Simplified34.5%

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

    \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}}}{\left(-1 - \frac{0.5 + \frac{-0.125}{x}}{x}\right) \cdot \left(-x\right)} \]
  9. Step-by-step derivation
    1. inv-pow98.5%

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

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

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

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

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

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

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

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

Alternative 6: 97.8% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  6. Step-by-step derivation
    1. mul-1-neg0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{-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)}} \]
    2. *-commutative0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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 x}} \]
    3. distribute-rgt-neg-in0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  7. Simplified34.5%

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

    \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}}}{\left(-1 - \frac{0.5 + \frac{-0.125}{x}}{x}\right) \cdot \left(-x\right)} \]
  9. Step-by-step derivation
    1. *-commutative98.5%

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\left(-x\right) \cdot \color{blue}{\left(-1 + \left(-\frac{0.5 + \frac{-0.125}{x}}{x}\right)\right)}} \]
    3. neg-mul-198.5%

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

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

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

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

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

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{x} \cdot -1 + \left(-x\right) \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    10. *-commutative31.8%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{-1 \cdot x} + \left(-x\right) \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    11. neg-mul-131.8%

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

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} + \left(-x\right) \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    14. sqr-neg79.6%

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

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

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

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

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

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    21. add-sqr-sqrt98.4%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \color{blue}{x} \cdot \left(-1 \cdot \frac{0.5 + \frac{-0.125}{x}}{x}\right)} \]
    22. neg-mul-198.4%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + x \cdot \color{blue}{\left(-\frac{0.5 + \frac{-0.125}{x}}{x}\right)}} \]
    23. distribute-neg-frac298.4%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + x \cdot \color{blue}{\frac{0.5 + \frac{-0.125}{x}}{-x}}} \]
  10. Applied egg-rr98.5%

    \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{x + x \cdot \frac{0.5 + \frac{0.125}{x}}{x}}} \]
  11. Step-by-step derivation
    1. *-commutative98.5%

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

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

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

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

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \left(0.5 + \frac{0.125}{x}\right) \cdot \left(\frac{\sqrt{x}}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} \cdot \sqrt{x}\right)} \]
    7. associate-/l/98.5%

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \left(0.5 + \frac{0.125}{x}\right) \cdot \left(\frac{\color{blue}{1}}{\sqrt{x}} \cdot \sqrt{x}\right)} \]
    9. lft-mult-inverse98.5%

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

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

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

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

Alternative 7: 97.8% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  6. Step-by-step derivation
    1. mul-1-neg0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{-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)}} \]
    2. *-commutative0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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 x}} \]
    3. distribute-rgt-neg-in0.0%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{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)}} \]
  7. Simplified34.5%

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

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

    \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{x \cdot \left(1 + 0.5 \cdot \frac{1}{x}\right)}} \]
  10. Step-by-step derivation
    1. distribute-rgt-in98.5%

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

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

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \frac{\color{blue}{0.5}}{x} \cdot x} \]
    5. associate-*l/98.5%

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \color{blue}{0.5 \cdot \frac{x}{x}}} \]
    7. rem-square-sqrt98.5%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + 0.5 \cdot \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{x}} \]
    8. associate-*l/98.5%

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

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + 0.5 \cdot \left(\color{blue}{\frac{\frac{\sqrt{x}}{\sqrt{x}}}{\sqrt{x}}} \cdot \sqrt{x}\right)} \]
    11. *-inverses98.5%

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + 0.5 \cdot \left(\frac{\color{blue}{1}}{\sqrt{x}} \cdot \sqrt{x}\right)} \]
    12. lft-mult-inverse98.5%

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

      \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{x + \color{blue}{0.5}} \]
  11. Simplified98.5%

    \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}}}{\color{blue}{x + 0.5}} \]
  12. Final simplification98.5%

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

Alternative 8: 97.7% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 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.7%

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  4. Step-by-step derivation
    1. inv-pow98.5%

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

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

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

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

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

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

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

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

  :alt
  (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))

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