\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq 5500:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x + \left(0.5 + \frac{-0.125}{x}\right)}}{\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 5500.0)
(- (pow x -0.5) (pow (+ 1.0 x) -0.5))
(/
(* (+ 1.0 (- x x)) (/ 1.0 (+ x (+ 0.5 (/ -0.125 x)))))
(+ (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 <= 5500.0) {
tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
} else {
tmp = ((1.0 + (x - x)) * (1.0 / (x + (0.5 + (-0.125 / x))))) / (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 <= 5500.0d0) then
tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-0.5d0))
else
tmp = ((1.0d0 + (x - x)) * (1.0d0 / (x + (0.5d0 + ((-0.125d0) / x))))) / (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 <= 5500.0) {
tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
} else {
tmp = ((1.0 + (x - x)) * (1.0 / (x + (0.5 + (-0.125 / x))))) / (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 <= 5500.0:
tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5)
else:
tmp = ((1.0 + (x - x)) * (1.0 / (x + (0.5 + (-0.125 / x))))) / (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 <= 5500.0)
tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5));
else
tmp = Float64(Float64(Float64(1.0 + Float64(x - x)) * Float64(1.0 / Float64(x + Float64(0.5 + Float64(-0.125 / x))))) / 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 <= 5500.0)
tmp = (x ^ -0.5) - ((1.0 + x) ^ -0.5);
else
tmp = ((1.0 + (x - x)) * (1.0 / (x + (0.5 + (-0.125 / x))))) / (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, 5500.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + N[(0.5 + N[(-0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 5500:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x + \left(0.5 + \frac{-0.125}{x}\right)}}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.2 |
|---|
| Cost | 27332 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x + 0.5}}{\sqrt{x} + t_0}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.5 |
|---|
| Cost | 27204 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x}}{\sqrt{x} + t_0}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - \frac{1}{t_0}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.3 |
|---|
| Cost | 26240 |
|---|
\[\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\mathsf{hypot}\left(x, \sqrt{x}\right)}
\]
| Alternative 4 |
|---|
| Error | 0.7 |
|---|
| Cost | 26240 |
|---|
\[\frac{1}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \mathsf{hypot}\left(x, \sqrt{x}\right)}
\]
| Alternative 5 |
|---|
| Error | 0.5 |
|---|
| Cost | 13636 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\mathbf{if}\;x \leq 85000000:\\
\;\;\;\;{x}^{-0.5} - \frac{1}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_0} \cdot \frac{1}{x}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 9.8 |
|---|
| Cost | 13448 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.7:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x + 0.5}}{1 + \sqrt{x}}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 9.3 |
|---|
| Cost | 13448 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 120000000:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x + 0.5}}{1 + \sqrt{x}}\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 9.3 |
|---|
| Cost | 13448 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 85000000:\\
\;\;\;\;{x}^{-0.5} - \frac{1}{\sqrt{1 + x}}\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x + 0.5}}{1 + \sqrt{x}}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 17.8 |
|---|
| Cost | 7492 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.49:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x + 0.5}}{1 + \sqrt{x}}\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 19.9 |
|---|
| Cost | 7236 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 2.6:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(1 + \sqrt{\frac{1}{x}}\right) \cdot \left(x \cdot x\right)}\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 19.9 |
|---|
| Cost | 7236 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 2.6:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{2}{x}}{x}}{1 + \sqrt{\frac{1}{x}}}\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 19.9 |
|---|
| Cost | 7172 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 5.8:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 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 | 20.0 |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.35:\\
\;\;\;\;\left(x \cdot 0.5 + \sqrt{\frac{1}{x}}\right) + -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 14 |
|---|
| Error | 20.1 |
|---|
| Cost | 6788 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.58:\\
\;\;\;\;{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 15 |
|---|
| Error | 21.0 |
|---|
| Cost | 6660 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.095:\\
\;\;\;\;{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 16 |
|---|
| Error | 49.1 |
|---|
| 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 17 |
|---|
| Error | 59.2 |
|---|
| Cost | 704 |
|---|
\[\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x + 0.5}
\]
| Alternative 18 |
|---|
| Error | 59.3 |
|---|
| Cost | 576 |
|---|
\[\left(1 + \left(x - x\right)\right) \cdot \frac{1}{x}
\]
| Alternative 19 |
|---|
| Error | 62.8 |
|---|
| Cost | 64 |
|---|
\[-1
\]
| Alternative 20 |
|---|
| Error | 60.3 |
|---|
| Cost | 64 |
|---|
\[2
\]