\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+153}:\\
\;\;\;\;\frac{{x}^{-0.5}}{x + \left(1 + \sqrt{x \cdot \left(x + 1\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\]
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
↓
(FPCore (x)
:precision binary64
(if (<= x 2e+153)
(/ (pow x -0.5) (+ x (+ 1.0 (sqrt (* x (+ x 1.0))))))
(* (pow x -0.5) (/ 0.5 x))))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
↓
double code(double x) {
double tmp;
if (x <= 2e+153) {
tmp = pow(x, -0.5) / (x + (1.0 + sqrt((x * (x + 1.0)))));
} else {
tmp = pow(x, -0.5) * (0.5 / 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 <= 2d+153) then
tmp = (x ** (-0.5d0)) / (x + (1.0d0 + sqrt((x * (x + 1.0d0)))))
else
tmp = (x ** (-0.5d0)) * (0.5d0 / 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 <= 2e+153) {
tmp = Math.pow(x, -0.5) / (x + (1.0 + Math.sqrt((x * (x + 1.0)))));
} else {
tmp = Math.pow(x, -0.5) * (0.5 / 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 <= 2e+153:
tmp = math.pow(x, -0.5) / (x + (1.0 + math.sqrt((x * (x + 1.0)))))
else:
tmp = math.pow(x, -0.5) * (0.5 / 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 <= 2e+153)
tmp = Float64((x ^ -0.5) / Float64(x + Float64(1.0 + sqrt(Float64(x * Float64(x + 1.0))))));
else
tmp = Float64((x ^ -0.5) * Float64(0.5 / 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 <= 2e+153)
tmp = (x ^ -0.5) / (x + (1.0 + sqrt((x * (x + 1.0)))));
else
tmp = (x ^ -0.5) * (0.5 / 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, 2e+153], N[(N[Power[x, -0.5], $MachinePrecision] / N[(x + N[(1.0 + N[Sqrt[N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision]]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
↓
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+153}:\\
\;\;\;\;\frac{{x}^{-0.5}}{x + \left(1 + \sqrt{x \cdot \left(x + 1\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.2 |
|---|
| Cost | 26756 |
|---|
\[\begin{array}{l}
t_0 := \frac{-1}{\sqrt{x + 1}}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + t_0 \leq 2 \cdot 10^{-8}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1}{1.5 + \left(x \cdot 2 + \frac{-0.125}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} + t_0\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.1 |
|---|
| Cost | 19776 |
|---|
\[\frac{{x}^{-0.5}}{x + \left(1 + \mathsf{hypot}\left(x, \sqrt{x}\right)\right)}
\]
| Alternative 3 |
|---|
| Error | 0.2 |
|---|
| Cost | 13380 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 4200:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1}{1.5 + \left(x \cdot 2 + \frac{-0.125}{x}\right)}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.5 |
|---|
| Cost | 7940 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.56:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1}{\left(x + 1\right) + \left(0.5 + \left(\left(x + \frac{0.0625}{x \cdot x}\right) + \frac{-0.125}{x}\right)\right)}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.6 |
|---|
| Cost | 7428 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.58:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1}{1.5 + \left(x \cdot 2 + \frac{-0.125}{x}\right)}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.7 |
|---|
| Cost | 7172 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.41:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1}{1.5 + x \cdot 2}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 0.7 |
|---|
| Cost | 7172 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.62:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1}{1.5 + x \cdot 2}\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 1.1 |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x} \cdot \frac{1}{\sqrt{x + 1}}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 1.1 |
|---|
| Cost | 7044 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 1.3 |
|---|
| Cost | 6916 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.66:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 20.3 |
|---|
| Cost | 6788 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.6:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(x - x\right)\right) \cdot \left(\frac{1}{0.25 - x \cdot x} \cdot \left(0.5 - x\right)\right)\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 21.2 |
|---|
| Cost | 6660 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.092:\\
\;\;\;\;{x}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(x - x\right)\right) \cdot \left(\frac{1}{0.25 - x \cdot x} \cdot \left(0.5 - x\right)\right)\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 49.4 |
|---|
| Cost | 1088 |
|---|
\[\left(1 + \left(x - x\right)\right) \cdot \left(\frac{1}{0.25 - x \cdot x} \cdot \left(0.5 - x\right)\right)
\]
| Alternative 14 |
|---|
| Error | 59.3 |
|---|
| Cost | 704 |
|---|
\[\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x + 0.5}
\]
| Alternative 15 |
|---|
| Error | 59.3 |
|---|
| Cost | 576 |
|---|
\[\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x}
\]
| Alternative 16 |
|---|
| Error | 60.3 |
|---|
| Cost | 64 |
|---|
\[2
\]