2isqrt (example 3.6)

Percentage Accurate: 39.4% → 99.7%
Time: 9.4s
Alternatives: 9
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 39.4% 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.7% accurate, 0.7× speedup?

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    4. *-rgt-identity39.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \left(-\sqrt{x}\right) \cdot \left(-\sqrt{x}\right)\right)}} \]
    9. sqr-neg99.4%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)} \]
    10. rem-square-sqrt99.7%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{x}\right)} \]
  8. Simplified99.7%

    \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, x\right)}} \]
  9. Step-by-step derivation
    1. fma-undefine99.6%

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

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

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

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

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

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

    \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{hypot}\left(\sqrt{x}, x\right) + x}} \]
  11. Taylor expanded in x around inf 99.8%

    \[\leadsto \frac{{\color{blue}{\left(x \cdot \left(1 + \frac{1}{x}\right)\right)}}^{-0.5}}{\mathsf{hypot}\left(\sqrt{x}, x\right) + x} \]
  12. Final simplification99.8%

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

Alternative 2: 99.7% accurate, 0.7× speedup?

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    4. *-rgt-identity39.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \left(-\sqrt{x}\right) \cdot \left(-\sqrt{x}\right)\right)}} \]
    9. sqr-neg99.4%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)} \]
    10. rem-square-sqrt99.7%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{x}\right)} \]
  8. Simplified99.7%

    \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, x\right)}} \]
  9. Step-by-step derivation
    1. fma-undefine99.6%

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

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

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

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

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

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

    \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{hypot}\left(\sqrt{x}, x\right) + x}} \]
  11. Final simplification99.8%

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

Alternative 3: 99.3% accurate, 0.9× speedup?

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    4. *-rgt-identity39.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \left(-\sqrt{x}\right) \cdot \left(-\sqrt{x}\right)\right)}} \]
    9. sqr-neg99.4%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)} \]
    10. rem-square-sqrt99.7%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{x}\right)} \]
  8. Simplified99.7%

    \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, x\right)}} \]
  9. Step-by-step derivation
    1. fma-undefine99.6%

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

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

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

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

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

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

    \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{hypot}\left(\sqrt{x}, x\right) + x}} \]
  11. Taylor expanded in x around inf 99.8%

    \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{x \cdot \left(\left(2 + \left(0.5 \cdot \frac{1}{x} + 0.0625 \cdot \frac{1}{{x}^{3}}\right)\right) - \frac{0.125}{{x}^{2}}\right)}} \]
  12. Step-by-step derivation
    1. associate--l+99.8%

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

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

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

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{x \cdot \left(2 + \left(\color{blue}{\left(0.0625 \cdot \frac{1}{{x}^{3}} + \frac{0.5}{x}\right)} - \frac{0.125}{{x}^{2}}\right)\right)} \]
    5. associate--l+99.8%

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{x \cdot \left(2 + \left(\frac{0.0625}{{x}^{3}} + \color{blue}{\frac{0.5 - 0.125 \cdot \frac{1}{x}}{x}}\right)\right)} \]
  13. Simplified99.8%

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

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

Alternative 4: 99.2% accurate, 1.0× speedup?

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    4. *-rgt-identity39.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \left(-\sqrt{x}\right) \cdot \left(-\sqrt{x}\right)\right)}} \]
    9. sqr-neg99.4%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)} \]
    10. rem-square-sqrt99.7%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{x}\right)} \]
  8. Simplified99.7%

    \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, x\right)}} \]
  9. Taylor expanded in x around inf 99.7%

    \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{x \cdot \left(\left(2 + 0.5 \cdot \frac{1}{x}\right) - \frac{0.125}{{x}^{2}}\right)}} \]
  10. Step-by-step derivation
    1. +-commutative99.7%

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

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

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

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

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

Alternative 5: 99.2% accurate, 1.0× speedup?

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    4. *-rgt-identity39.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \left(-\sqrt{x}\right) \cdot \left(-\sqrt{x}\right)\right)}} \]
    9. sqr-neg99.4%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)} \]
    10. rem-square-sqrt99.7%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{x}\right)} \]
  8. Simplified99.7%

    \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, x\right)}} \]
  9. Taylor expanded in x around inf 99.7%

    \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{x \cdot \left(\left(2 + 0.5 \cdot \frac{1}{x}\right) - \frac{0.125}{{x}^{2}}\right)}} \]
  10. Step-by-step derivation
    1. +-commutative99.7%

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

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

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

    \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{x \cdot \left(\left(\frac{0.5}{x} + 2\right) - \frac{0.125}{{x}^{2}}\right)}} \]
  12. Step-by-step derivation
    1. *-un-lft-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 98.9% accurate, 1.9× speedup?

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    4. *-rgt-identity39.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \left(-\sqrt{x}\right) \cdot \left(-\sqrt{x}\right)\right)}} \]
    9. sqr-neg99.4%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)} \]
    10. rem-square-sqrt99.7%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{x}\right)} \]
  8. Simplified99.7%

    \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, x\right)}} \]
  9. Taylor expanded in x around inf 99.4%

    \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{x \cdot \left(2 + 0.5 \cdot \frac{1}{x}\right)}} \]
  10. Step-by-step derivation
    1. +-commutative99.4%

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

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

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

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

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

Alternative 7: 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 39.8%

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right)\right)} - \frac{1}{\sqrt{x + 1}} \]
    2. expm1-undefine4.6%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right)} - 1\right)} - \frac{1}{\sqrt{x + 1}} \]
    3. inv-pow4.6%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{{\left(\sqrt{x}\right)}^{-1}}\right)} - 1\right) - \frac{1}{\sqrt{x + 1}} \]
    4. sqrt-pow24.6%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}}\right)} - 1\right) - \frac{1}{\sqrt{x + 1}} \]
    5. metadata-eval4.6%

      \[\leadsto \left(e^{\mathsf{log1p}\left({x}^{\color{blue}{-0.5}}\right)} - 1\right) - \frac{1}{\sqrt{x + 1}} \]
  4. Applied egg-rr4.6%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left({x}^{-0.5}\right)} - 1\right)} - \frac{1}{\sqrt{x + 1}} \]
  5. Step-by-step derivation
    1. log1p-undefine4.6%

      \[\leadsto \left(e^{\color{blue}{\log \left(1 + {x}^{-0.5}\right)}} - 1\right) - \frac{1}{\sqrt{x + 1}} \]
    2. rem-exp-log4.6%

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

      \[\leadsto \left(\color{blue}{\left({x}^{-0.5} + 1\right)} - 1\right) - \frac{1}{\sqrt{x + 1}} \]
    4. associate--l+33.0%

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

      \[\leadsto \left({x}^{-0.5} + \color{blue}{0}\right) - \frac{1}{\sqrt{x + 1}} \]
    6. +-rgt-identity33.0%

      \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  6. Simplified33.0%

    \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  7. Taylor expanded in x around inf 68.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{x}^{-1.5}} \cdot 0.5 \]
  13. Simplified98.8%

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

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

Alternative 8: 38.6% accurate, 26.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 7.8%

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

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

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

        \[\leadsto \left(\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      4. *-rgt-identity7.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right) \cdot {\left({\left(1 + x\right)}^{0.25}\right)}^{-2}}{\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}}} \]
      5. add-sqr-sqrt8.8%

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

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

        \[\leadsto \frac{\left(\left(1 + x\right) - x\right) \cdot \color{blue}{{\left(1 + x\right)}^{\left(0.25 \cdot -2\right)}}}{\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}} \]
      8. metadata-eval10.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \left(-\sqrt{x}\right) \cdot \left(-\sqrt{x}\right)\right)}} \]
      9. sqr-neg99.0%

        \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)} \]
      10. rem-square-sqrt99.6%

        \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, \color{blue}{x}\right)} \]
    8. Simplified99.6%

      \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{1 + x}, x\right)}} \]
    9. Taylor expanded in x around inf 97.5%

      \[\leadsto \frac{{\left(1 + x\right)}^{-0.5}}{\color{blue}{2 \cdot x}} \]
    10. Step-by-step derivation
      1. *-commutative97.5%

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

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

      \[\leadsto \color{blue}{\frac{0.5}{x}} \]

    if 6.4000000000000003e153 < x

    1. Initial program 72.8%

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

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

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

        \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{{\left(\sqrt{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt{\sqrt{x + 1}}\right)}^{-1}} \]
      4. pow1/229.7%

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

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

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

        \[\leadsto \frac{1}{\sqrt{x}} - {\left({\left(1 + x\right)}^{\color{blue}{0.25}}\right)}^{-1} \cdot {\left(\sqrt{\sqrt{x + 1}}\right)}^{-1} \]
      8. pow1/234.1%

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{x}} - {\left({\left(1 + x\right)}^{0.25}\right)}^{\color{blue}{-2}} \]
    6. Simplified46.5%

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

      \[\leadsto \frac{1}{\sqrt{x}} - {\left({\color{blue}{x}}^{0.25}\right)}^{-2} \]
    8. Taylor expanded in x around 0 72.8%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 36.5% accurate, 209.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x) :precision binary64 0.0)
double code(double x) {
	return 0.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 0.0d0
end function
public static double code(double x) {
	return 0.0;
}
def code(x):
	return 0.0
function code(x)
	return 0.0
end
function tmp = code(x)
	tmp = 0.0;
end
code[x_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 39.8%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{{\left(\sqrt{x + 1}\right)}^{-1}} \]
    2. add-sqr-sqrt29.5%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{{\left(\sqrt{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt{\sqrt{x + 1}}\right)}^{-1}} \]
    4. pow1/218.7%

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

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

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

      \[\leadsto \frac{1}{\sqrt{x}} - {\left({\left(1 + x\right)}^{\color{blue}{0.25}}\right)}^{-1} \cdot {\left(\sqrt{\sqrt{x + 1}}\right)}^{-1} \]
    8. pow1/220.9%

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

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

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

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

    \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{{\left({\left(1 + x\right)}^{0.25}\right)}^{-1} \cdot {\left({\left(1 + x\right)}^{0.25}\right)}^{-1}} \]
  5. Step-by-step derivation
    1. pow-sqr27.0%

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

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

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

    \[\leadsto \frac{1}{\sqrt{x}} - {\left({\color{blue}{x}}^{0.25}\right)}^{-2} \]
  8. Taylor expanded in x around 0 38.1%

    \[\leadsto \color{blue}{0} \]
  9. Add Preprocessing

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

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

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

Developer Target 2: 39.4% accurate, 1.0× speedup?

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

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

Reproduce

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

  :alt
  (! :herbie-platform default (- (pow x -1/2) (pow (+ x 1) -1/2)))

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