2isqrt (example 3.6)

Percentage Accurate: 38.3% → 99.3%
Time: 9.5s
Alternatives: 8
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 8 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.3% 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.3% accurate, 0.4× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\frac{\sqrt{x + 1}}{1}}} \]
    2. frac-subN/A

      \[\leadsto \frac{1 \cdot \frac{\sqrt{x + 1}}{1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}}} \]
    3. /-rgt-identityN/A

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    4. *-lft-identityN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{\color{blue}{x}} \cdot \frac{\sqrt{x + 1}}{1}} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot \frac{1}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    6. div-invN/A

      \[\leadsto \frac{\sqrt{x + 1} - \frac{\sqrt{x}}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    7. flip--N/A

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

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

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

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \frac{\color{blue}{\sqrt{x + 1}}}{1}} \]
    11. /-rgt-identityN/A

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \sqrt{x + 1}} \]
    12. associate-/l/N/A

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

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

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

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

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

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x \cdot \left(1 + x\right)}\right)}^{-1} \]
    6. sqrt-prodN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 + x}\right)\right)}^{-1} \]
    7. associate-*r*N/A

      \[\leadsto {\left(\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right) \cdot \sqrt{1 + x}\right)}^{-1} \]
    8. unpow-prod-downN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x}\right)}^{\left(2 \cdot \color{blue}{\frac{-1}{2}}\right)} \]
    10. pow-powN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x} \cdot \sqrt{1 + x}\right)}^{\frac{-1}{2}} \]
    12. rem-square-sqrtN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(1 + x\right)}^{\frac{-1}{2}} \]
    13. *-lowering-*.f64N/A

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

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

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

Alternative 2: 99.2% accurate, 1.8× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\frac{\sqrt{x + 1}}{1}}} \]
    2. frac-subN/A

      \[\leadsto \frac{1 \cdot \frac{\sqrt{x + 1}}{1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}}} \]
    3. /-rgt-identityN/A

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    4. *-lft-identityN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{\color{blue}{x}} \cdot \frac{\sqrt{x + 1}}{1}} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot \frac{1}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    6. div-invN/A

      \[\leadsto \frac{\sqrt{x + 1} - \frac{\sqrt{x}}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    7. flip--N/A

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

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

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

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \frac{\color{blue}{\sqrt{x + 1}}}{1}} \]
    11. /-rgt-identityN/A

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \sqrt{x + 1}} \]
    12. associate-/l/N/A

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

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

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

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

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

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x \cdot \left(1 + x\right)}\right)}^{-1} \]
    6. sqrt-prodN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 + x}\right)\right)}^{-1} \]
    7. associate-*r*N/A

      \[\leadsto {\left(\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right) \cdot \sqrt{1 + x}\right)}^{-1} \]
    8. unpow-prod-downN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x}\right)}^{\left(2 \cdot \color{blue}{\frac{-1}{2}}\right)} \]
    10. pow-powN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x} \cdot \sqrt{1 + x}\right)}^{\frac{-1}{2}} \]
    12. rem-square-sqrtN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(1 + x\right)}^{\frac{-1}{2}} \]
    13. *-lowering-*.f64N/A

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

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\left(\frac{1}{2} + \frac{1}{16} \cdot \frac{1}{{x}^{2}}\right) - \frac{\frac{1}{8}}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  8. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\left(\frac{1}{2} + \frac{1}{16} \cdot \frac{1}{{x}^{2}}\right) - \frac{\frac{1}{8}}{x}\right), x\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{+.f64}\left(1, x\right)}, \frac{-1}{2}\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}} + \frac{1}{2}\right) - \frac{\frac{1}{8}}{x}\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    3. associate--l+N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}} + \left(\frac{1}{2} - \frac{\frac{1}{8}}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}} + \left(\frac{1}{2} - \frac{\frac{1}{8} \cdot 1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}} + \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}}\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{\frac{1}{16} \cdot 1}{{x}^{2}}\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{\frac{1}{16}}{{x}^{2}}\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \left({x}^{2}\right)\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \left(x \cdot x\right)\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    12. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{1}{x}\right)\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    13. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8} \cdot 1}{x}\right)\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    15. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    16. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    17. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\frac{-1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    18. /-lowering-/.f6498.8%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\frac{-1}{8}, x\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  9. Simplified98.8%

    \[\leadsto \color{blue}{\frac{\frac{0.0625}{x \cdot x} + \left(0.5 + \frac{-0.125}{x}\right)}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  10. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left({\left(1 + x\right)}^{\frac{-1}{2}}\right), \color{blue}{\left(\frac{x}{\frac{\frac{1}{16}}{x \cdot x} + \left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right)}\right)}\right) \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(1 + x\right), \frac{-1}{2}\right), \left(\frac{\color{blue}{x}}{\frac{\frac{1}{16}}{x \cdot x} + \left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right)}\right)\right) \]
    6. +-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(x + 1\right), \frac{-1}{2}\right), \left(\frac{x}{\frac{\frac{1}{16}}{x \cdot x} + \left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right)}\right)\right) \]
    7. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{x}{\frac{\frac{1}{16}}{x \cdot x} + \left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right)}\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{\frac{1}{16}}{x \cdot x} + \left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right)\right)}\right)\right) \]
    9. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\frac{1}{16}}{x \cdot x}\right), \color{blue}{\left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right)}\right)\right)\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \left(x \cdot x\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{\frac{-1}{8}}{x}\right)\right)\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right)\right)\right)\right) \]
    12. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left(\frac{\frac{-1}{8}}{x}\right)}\right)\right)\right)\right) \]
    13. /-lowering-/.f6499.0%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\frac{-1}{8}, \color{blue}{x}\right)\right)\right)\right)\right) \]
  11. Applied egg-rr99.0%

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

Alternative 3: 99.1% 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 38.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\frac{\sqrt{x + 1}}{1}}} \]
    2. frac-subN/A

      \[\leadsto \frac{1 \cdot \frac{\sqrt{x + 1}}{1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}}} \]
    3. /-rgt-identityN/A

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    4. *-lft-identityN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{\color{blue}{x}} \cdot \frac{\sqrt{x + 1}}{1}} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot \frac{1}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    6. div-invN/A

      \[\leadsto \frac{\sqrt{x + 1} - \frac{\sqrt{x}}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    7. flip--N/A

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

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

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

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \frac{\color{blue}{\sqrt{x + 1}}}{1}} \]
    11. /-rgt-identityN/A

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \sqrt{x + 1}} \]
    12. associate-/l/N/A

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

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

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

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

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

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x \cdot \left(1 + x\right)}\right)}^{-1} \]
    6. sqrt-prodN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 + x}\right)\right)}^{-1} \]
    7. associate-*r*N/A

      \[\leadsto {\left(\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right) \cdot \sqrt{1 + x}\right)}^{-1} \]
    8. unpow-prod-downN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x}\right)}^{\left(2 \cdot \color{blue}{\frac{-1}{2}}\right)} \]
    10. pow-powN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x} \cdot \sqrt{1 + x}\right)}^{\frac{-1}{2}} \]
    12. rem-square-sqrtN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(1 + x\right)}^{\frac{-1}{2}} \]
    13. *-lowering-*.f64N/A

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

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\left(\frac{1}{2} + \frac{1}{16} \cdot \frac{1}{{x}^{2}}\right) - \frac{\frac{1}{8}}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  8. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\left(\frac{1}{2} + \frac{1}{16} \cdot \frac{1}{{x}^{2}}\right) - \frac{\frac{1}{8}}{x}\right), x\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{+.f64}\left(1, x\right)}, \frac{-1}{2}\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}} + \frac{1}{2}\right) - \frac{\frac{1}{8}}{x}\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    3. associate--l+N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}} + \left(\frac{1}{2} - \frac{\frac{1}{8}}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}} + \left(\frac{1}{2} - \frac{\frac{1}{8} \cdot 1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}} + \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{1}{16} \cdot \frac{1}{{x}^{2}}\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{\frac{1}{16} \cdot 1}{{x}^{2}}\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{\frac{1}{16}}{{x}^{2}}\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \left({x}^{2}\right)\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \left(x \cdot x\right)\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    12. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{1}{x}\right)\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    13. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8} \cdot 1}{x}\right)\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    15. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    16. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    17. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\frac{-1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    18. /-lowering-/.f6498.8%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\frac{-1}{8}, x\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  9. Simplified98.8%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\left(\frac{1}{2} + \frac{\frac{1}{16}}{{x}^{2}}\right) - \frac{1}{8} \cdot \frac{1}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  11. Simplified98.8%

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

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

Alternative 4: 98.9% accurate, 1.9× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\frac{\sqrt{x + 1}}{1}}} \]
    2. frac-subN/A

      \[\leadsto \frac{1 \cdot \frac{\sqrt{x + 1}}{1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}}} \]
    3. /-rgt-identityN/A

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    4. *-lft-identityN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{\color{blue}{x}} \cdot \frac{\sqrt{x + 1}}{1}} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot \frac{1}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    6. div-invN/A

      \[\leadsto \frac{\sqrt{x + 1} - \frac{\sqrt{x}}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    7. flip--N/A

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

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

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

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \frac{\color{blue}{\sqrt{x + 1}}}{1}} \]
    11. /-rgt-identityN/A

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \sqrt{x + 1}} \]
    12. associate-/l/N/A

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

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

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

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

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

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x \cdot \left(1 + x\right)}\right)}^{-1} \]
    6. sqrt-prodN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 + x}\right)\right)}^{-1} \]
    7. associate-*r*N/A

      \[\leadsto {\left(\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right) \cdot \sqrt{1 + x}\right)}^{-1} \]
    8. unpow-prod-downN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x}\right)}^{\left(2 \cdot \color{blue}{\frac{-1}{2}}\right)} \]
    10. pow-powN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x} \cdot \sqrt{1 + x}\right)}^{\frac{-1}{2}} \]
    12. rem-square-sqrtN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(1 + x\right)}^{\frac{-1}{2}} \]
    13. *-lowering-*.f64N/A

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

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  8. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right), x\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{+.f64}\left(1, x\right)}, \frac{-1}{2}\right)\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    3. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8} \cdot 1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    5. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    6. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\frac{-1}{8}}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    8. /-lowering-/.f6498.5%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\frac{-1}{8}, x\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  9. Simplified98.5%

    \[\leadsto \color{blue}{\frac{0.5 + \frac{-0.125}{x}}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  10. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left({\left(1 + x\right)}^{\frac{-1}{2}}\right), \color{blue}{\left(\frac{x}{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}\right)}\right) \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(1 + x\right), \frac{-1}{2}\right), \left(\frac{\color{blue}{x}}{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}\right)\right) \]
    6. +-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(x + 1\right), \frac{-1}{2}\right), \left(\frac{x}{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}\right)\right) \]
    7. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{x}{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right)}\right)\right) \]
    9. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left(\frac{\frac{-1}{8}}{x}\right)}\right)\right)\right) \]
    10. /-lowering-/.f6498.6%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\frac{-1}{8}, \color{blue}{x}\right)\right)\right)\right) \]
  11. Applied egg-rr98.6%

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

Alternative 5: 98.8% accurate, 1.9× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\frac{\sqrt{x + 1}}{1}}} \]
    2. frac-subN/A

      \[\leadsto \frac{1 \cdot \frac{\sqrt{x + 1}}{1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}}} \]
    3. /-rgt-identityN/A

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    4. *-lft-identityN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{\color{blue}{x}} \cdot \frac{\sqrt{x + 1}}{1}} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot \frac{1}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    6. div-invN/A

      \[\leadsto \frac{\sqrt{x + 1} - \frac{\sqrt{x}}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    7. flip--N/A

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

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

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

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \frac{\color{blue}{\sqrt{x + 1}}}{1}} \]
    11. /-rgt-identityN/A

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \sqrt{x + 1}} \]
    12. associate-/l/N/A

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

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

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

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

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

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x \cdot \left(1 + x\right)}\right)}^{-1} \]
    6. sqrt-prodN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 + x}\right)\right)}^{-1} \]
    7. associate-*r*N/A

      \[\leadsto {\left(\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right) \cdot \sqrt{1 + x}\right)}^{-1} \]
    8. unpow-prod-downN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x}\right)}^{\left(2 \cdot \color{blue}{\frac{-1}{2}}\right)} \]
    10. pow-powN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x} \cdot \sqrt{1 + x}\right)}^{\frac{-1}{2}} \]
    12. rem-square-sqrtN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(1 + x\right)}^{\frac{-1}{2}} \]
    13. *-lowering-*.f64N/A

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

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  8. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right), x\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{+.f64}\left(1, x\right)}, \frac{-1}{2}\right)\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    3. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8} \cdot 1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    5. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    6. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\frac{-1}{8}}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    8. /-lowering-/.f6498.5%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\frac{-1}{8}, x\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  9. Simplified98.5%

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

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

Alternative 6: 97.9% 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 38.3%

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

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
  4. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(\sqrt{\frac{1}{{x}^{3}}}\right)}\right) \]
    2. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\left(\frac{1}{{x}^{3}}\right)\right)\right) \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, \left({x}^{3}\right)\right)\right)\right) \]
    4. cube-multN/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, \left(x \cdot {x}^{2}\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \left({x}^{2}\right)\right)\right)\right)\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot x\right)\right)\right)\right)\right) \]
    8. *-lowering-*.f6466.3%

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right)\right) \]
  5. Simplified66.3%

    \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x \cdot \left(x \cdot x\right)}}} \]
  6. Step-by-step derivation
    1. *-commutativeN/A

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

      \[\leadsto \sqrt{{\left(x \cdot \left(x \cdot x\right)\right)}^{-1}} \cdot \frac{1}{2} \]
    3. sqrt-pow1N/A

      \[\leadsto {\left(x \cdot \left(x \cdot x\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot \frac{1}{2} \]
    4. metadata-evalN/A

      \[\leadsto {\left(x \cdot \left(x \cdot x\right)\right)}^{\frac{-1}{2}} \cdot \frac{1}{2} \]
    5. unpow-prod-downN/A

      \[\leadsto \left({x}^{\frac{-1}{2}} \cdot {\left(x \cdot x\right)}^{\frac{-1}{2}}\right) \cdot \frac{1}{2} \]
    6. pow-prod-downN/A

      \[\leadsto \left({x}^{\frac{-1}{2}} \cdot \left({x}^{\frac{-1}{2}} \cdot {x}^{\frac{-1}{2}}\right)\right) \cdot \frac{1}{2} \]
    7. cube-multN/A

      \[\leadsto {\left({x}^{\frac{-1}{2}}\right)}^{3} \cdot \frac{1}{2} \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left({\left({x}^{\frac{-1}{2}}\right)}^{3}\right), \color{blue}{\frac{1}{2}}\right) \]
    9. pow-powN/A

      \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{-1}{2} \cdot 3\right)}\right), \frac{1}{2}\right) \]
    10. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \left(\frac{-1}{2} \cdot 3\right)\right), \frac{1}{2}\right) \]
    11. metadata-eval97.6%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \frac{-3}{2}\right), \frac{1}{2}\right) \]
  7. Applied egg-rr97.6%

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

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

Alternative 7: 37.4% accurate, 17.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.4 \cdot 10^{+153}:\\
\;\;\;\;\frac{\frac{-0.125}{x} + 0.5625}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{-0.125}{x \cdot x}\\


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

    1. Initial program 10.8%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\frac{\sqrt{x + 1}}{1}}} \]
      2. frac-subN/A

        \[\leadsto \frac{1 \cdot \frac{\sqrt{x + 1}}{1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}}} \]
      3. /-rgt-identityN/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
      4. *-lft-identityN/A

        \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{\color{blue}{x}} \cdot \frac{\sqrt{x + 1}}{1}} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot \frac{1}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
      6. div-invN/A

        \[\leadsto \frac{\sqrt{x + 1} - \frac{\sqrt{x}}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
      7. flip--N/A

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

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

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

        \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \frac{\color{blue}{\sqrt{x + 1}}}{1}} \]
      11. /-rgt-identityN/A

        \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \sqrt{x + 1}} \]
      12. associate-/l/N/A

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

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

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

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

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

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

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x \cdot \left(1 + x\right)}\right)}^{-1} \]
      6. sqrt-prodN/A

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 + x}\right)\right)}^{-1} \]
      7. associate-*r*N/A

        \[\leadsto {\left(\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right) \cdot \sqrt{1 + x}\right)}^{-1} \]
      8. unpow-prod-downN/A

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

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x}\right)}^{\left(2 \cdot \color{blue}{\frac{-1}{2}}\right)} \]
      10. pow-powN/A

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

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x} \cdot \sqrt{1 + x}\right)}^{\frac{-1}{2}} \]
      12. rem-square-sqrtN/A

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(1 + x\right)}^{\frac{-1}{2}} \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left({\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1}\right), \color{blue}{\left({\left(1 + x\right)}^{\frac{-1}{2}}\right)}\right) \]
    6. Applied egg-rr99.0%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    8. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right), x\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{+.f64}\left(1, x\right)}, \frac{-1}{2}\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8} \cdot 1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\frac{-1}{8}}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
      8. /-lowering-/.f6497.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\frac{-1}{8}, x\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    9. Simplified97.4%

      \[\leadsto \color{blue}{\frac{0.5 + \frac{-0.125}{x}}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
    10. Taylor expanded in x around 0

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

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

        \[\leadsto \frac{\frac{\frac{9}{16} \cdot x - \frac{1}{8}}{x}}{\color{blue}{x}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{9}{16} \cdot x - \frac{1}{8}}{x}\right), \color{blue}{x}\right) \]
      4. div-subN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{9}{16} \cdot x}{x} - \frac{\frac{1}{8}}{x}\right), x\right) \]
      5. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{9}{16} \cdot \frac{x}{x} - \frac{\frac{1}{8}}{x}\right), x\right) \]
      6. *-rgt-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{9}{16} \cdot \frac{x \cdot 1}{x} - \frac{\frac{1}{8}}{x}\right), x\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{9}{16} \cdot \left(x \cdot \frac{1}{x}\right) - \frac{\frac{1}{8}}{x}\right), x\right) \]
      8. rgt-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{9}{16} \cdot 1 - \frac{\frac{1}{8}}{x}\right), x\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{9}{16} - \frac{\frac{1}{8}}{x}\right), x\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{9}{16} - \frac{\frac{1}{8} \cdot 1}{x}\right), x\right) \]
      11. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{9}{16} - \frac{1}{8} \cdot \frac{1}{x}\right), x\right) \]
      12. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{9}{16} + \left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{1}{x}\right)\right)\right), x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{9}{16}, \left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{1}{x}\right)\right)\right), x\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{9}{16}, \left(\mathsf{neg}\left(\frac{\frac{1}{8} \cdot 1}{x}\right)\right)\right), x\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{9}{16}, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right) \]
      16. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{9}{16}, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{x}\right)\right), x\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{9}{16}, \left(\frac{\frac{-1}{8}}{x}\right)\right), x\right) \]
      18. /-lowering-/.f648.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{9}{16}, \mathsf{/.f64}\left(\frac{-1}{8}, x\right)\right), x\right) \]
    12. Simplified8.6%

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

    if 6.4000000000000003e153 < x

    1. Initial program 66.2%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\frac{\sqrt{x + 1}}{1}}} \]
      2. frac-subN/A

        \[\leadsto \frac{1 \cdot \frac{\sqrt{x + 1}}{1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}}} \]
      3. /-rgt-identityN/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
      4. *-lft-identityN/A

        \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{\color{blue}{x}} \cdot \frac{\sqrt{x + 1}}{1}} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot \frac{1}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
      6. div-invN/A

        \[\leadsto \frac{\sqrt{x + 1} - \frac{\sqrt{x}}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
      7. flip--N/A

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

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

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

        \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \frac{\color{blue}{\sqrt{x + 1}}}{1}} \]
      11. /-rgt-identityN/A

        \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \sqrt{x + 1}} \]
      12. associate-/l/N/A

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

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

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

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

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

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

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x \cdot \left(1 + x\right)}\right)}^{-1} \]
      6. sqrt-prodN/A

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 + x}\right)\right)}^{-1} \]
      7. associate-*r*N/A

        \[\leadsto {\left(\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right) \cdot \sqrt{1 + x}\right)}^{-1} \]
      8. unpow-prod-downN/A

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

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x}\right)}^{\left(2 \cdot \color{blue}{\frac{-1}{2}}\right)} \]
      10. pow-powN/A

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

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x} \cdot \sqrt{1 + x}\right)}^{\frac{-1}{2}} \]
      12. rem-square-sqrtN/A

        \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(1 + x\right)}^{\frac{-1}{2}} \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left({\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1}\right), \color{blue}{\left({\left(1 + x\right)}^{\frac{-1}{2}}\right)}\right) \]
    6. Applied egg-rr99.6%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    8. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right), x\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{+.f64}\left(1, x\right)}, \frac{-1}{2}\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8} \cdot 1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\frac{-1}{8}}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
      8. /-lowering-/.f6499.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\frac{-1}{8}, x\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    9. Simplified99.8%

      \[\leadsto \color{blue}{\frac{0.5 + \frac{-0.125}{x}}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
    10. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{\frac{-1}{8}}{{x}^{2}}} \]
    11. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\frac{-1}{8}, \left(x \cdot \color{blue}{x}\right)\right) \]
      3. *-lowering-*.f6466.2%

        \[\leadsto \mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right) \]
    12. Simplified66.2%

      \[\leadsto \color{blue}{\frac{-0.125}{x \cdot x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification37.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 6.4 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{-0.125}{x} + 0.5625}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.125}{x \cdot x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 34.7% accurate, 41.8× speedup?

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

\\
\frac{-0.125}{x \cdot x}
\end{array}
Derivation
  1. Initial program 38.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\frac{\sqrt{x + 1}}{1}}} \]
    2. frac-subN/A

      \[\leadsto \frac{1 \cdot \frac{\sqrt{x + 1}}{1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}}} \]
    3. /-rgt-identityN/A

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    4. *-lft-identityN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{\color{blue}{x}} \cdot \frac{\sqrt{x + 1}}{1}} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\sqrt{x + 1} - \sqrt{x} \cdot \frac{1}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    6. div-invN/A

      \[\leadsto \frac{\sqrt{x + 1} - \frac{\sqrt{x}}{1}}{\sqrt{x} \cdot \frac{\sqrt{x + 1}}{1}} \]
    7. flip--N/A

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

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

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

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \frac{\color{blue}{\sqrt{x + 1}}}{1}} \]
    11. /-rgt-identityN/A

      \[\leadsto \frac{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{1}}{\sqrt{x + 1} + \frac{\sqrt{x}}{1}}}{\frac{\sqrt{x}}{1} \cdot \sqrt{x + 1}} \]
    12. associate-/l/N/A

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

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

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

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

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

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x \cdot \left(1 + x\right)}\right)}^{-1} \]
    6. sqrt-prodN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 + x}\right)\right)}^{-1} \]
    7. associate-*r*N/A

      \[\leadsto {\left(\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right) \cdot \sqrt{1 + x}\right)}^{-1} \]
    8. unpow-prod-downN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x}\right)}^{\left(2 \cdot \color{blue}{\frac{-1}{2}}\right)} \]
    10. pow-powN/A

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

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(\sqrt{1 + x} \cdot \sqrt{1 + x}\right)}^{\frac{-1}{2}} \]
    12. rem-square-sqrtN/A

      \[\leadsto {\left(\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}\right)}^{-1} \cdot {\left(1 + x\right)}^{\frac{-1}{2}} \]
    13. *-lowering-*.f64N/A

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

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  8. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}\right), x\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{+.f64}\left(1, x\right)}, \frac{-1}{2}\right)\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    3. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8} \cdot 1}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    5. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{x}\right)\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(\color{blue}{1}, x\right), \frac{-1}{2}\right)\right) \]
    6. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{\frac{-1}{8}}{x}\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    8. /-lowering-/.f6498.5%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\frac{-1}{8}, x\right)\right), x\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  9. Simplified98.5%

    \[\leadsto \color{blue}{\frac{0.5 + \frac{-0.125}{x}}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  10. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{\frac{-1}{8}}{{x}^{2}}} \]
  11. Step-by-step derivation
    1. /-lowering-/.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\frac{-1}{8}, \left(x \cdot \color{blue}{x}\right)\right) \]
    3. *-lowering-*.f6434.4%

      \[\leadsto \mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right) \]
  12. Simplified34.4%

    \[\leadsto \color{blue}{\frac{-0.125}{x \cdot x}} \]
  13. 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 2024147 
(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)))))