\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq 165000:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x + 0.5}}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\]
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
↓
(FPCore (x)
:precision binary64
(if (<= x 165000.0)
(- (pow x -0.5) (pow (+ 1.0 x) -0.5))
(/ (/ 1.0 (+ x 0.5)) (+ (sqrt x) (sqrt (+ 1.0 x))))))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
↓
double code(double x) {
double tmp;
if (x <= 165000.0) {
tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
} else {
tmp = (1.0 / (x + 0.5)) / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / sqrt(x)) - (1.0d0 / sqrt((x + 1.0d0)))
end function
↓
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 165000.0d0) then
tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-0.5d0))
else
tmp = (1.0d0 / (x + 0.5d0)) / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
public static double code(double x) {
return (1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((x + 1.0)));
}
↓
public static double code(double x) {
double tmp;
if (x <= 165000.0) {
tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
} else {
tmp = (1.0 / (x + 0.5)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
def code(x):
return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
↓
def code(x):
tmp = 0
if x <= 165000.0:
tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5)
else:
tmp = (1.0 / (x + 0.5)) / (math.sqrt(x) + math.sqrt((1.0 + x)))
return tmp
function code(x)
return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0))))
end
↓
function code(x)
tmp = 0.0
if (x <= 165000.0)
tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5));
else
tmp = Float64(Float64(1.0 / Float64(x + 0.5)) / Float64(sqrt(x) + sqrt(Float64(1.0 + x))));
end
return tmp
end
function tmp = code(x)
tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
end
↓
function tmp_2 = code(x)
tmp = 0.0;
if (x <= 165000.0)
tmp = (x ^ -0.5) - ((1.0 + x) ^ -0.5);
else
tmp = (1.0 / (x + 0.5)) / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
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]
↓
code[x_] := If[LessEqual[x, 165000.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x + 0.5), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
↓
\begin{array}{l}
\mathbf{if}\;x \leq 165000:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x + 0.5}}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Accuracy | 99.2% |
|---|
| Cost | 26820 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\frac{1}{x}}{\sqrt{x} + t_0}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\end{array}
\]
| Alternative 2 |
|---|
| Accuracy | 99.2% |
|---|
| Cost | 26692 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\sqrt{x}}{x} \cdot \frac{0.5}{1 + x}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\end{array}
\]
| Alternative 3 |
|---|
| Accuracy | 98.9% |
|---|
| Cost | 26368 |
|---|
\[\frac{1}{\frac{\mathsf{hypot}\left(x, \sqrt{x}\right)}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}
\]
| Alternative 4 |
|---|
| Accuracy | 98.1% |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.42:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{x}}{x} \cdot \frac{0.5}{1 + x}\\
\end{array}
\]
| Alternative 5 |
|---|
| Accuracy | 72.1% |
|---|
| Cost | 6980 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.64:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(1 + \sqrt{x}\right)}\\
\end{array}
\]
| Alternative 6 |
|---|
| Accuracy | 67.7% |
|---|
| Cost | 6916 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 4:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(-1 - {x}^{-0.5}\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Accuracy | 53.5% |
|---|
| Cost | 6788 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.6:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x + 0.5}\\
\end{array}
\]
| Alternative 8 |
|---|
| Accuracy | 7.4% |
|---|
| Cost | 320 |
|---|
\[\frac{1}{x + 0.5}
\]
| Alternative 9 |
|---|
| Accuracy | 7.4% |
|---|
| Cost | 192 |
|---|
\[\frac{1}{x}
\]
| Alternative 10 |
|---|
| Accuracy | 5.8% |
|---|
| Cost | 64 |
|---|
\[2
\]