\[\sqrt{x + 1} - \sqrt{x}
\]
↓
\[\sqrt{{\left(\sqrt{x} + \sqrt{1 + x}\right)}^{-2}}
\]
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
↓
(FPCore (x)
:precision binary64
(sqrt (pow (+ (sqrt x) (sqrt (+ 1.0 x))) -2.0)))
double code(double x) {
return sqrt((x + 1.0)) - sqrt(x);
}
↓
double code(double x) {
return sqrt(pow((sqrt(x) + sqrt((1.0 + x))), -2.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
↓
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt(((sqrt(x) + sqrt((1.0d0 + x))) ** (-2.0d0)))
end function
public static double code(double x) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
↓
public static double code(double x) {
return Math.sqrt(Math.pow((Math.sqrt(x) + Math.sqrt((1.0 + x))), -2.0));
}
def code(x):
return math.sqrt((x + 1.0)) - math.sqrt(x)
↓
def code(x):
return math.sqrt(math.pow((math.sqrt(x) + math.sqrt((1.0 + x))), -2.0))
function code(x)
return Float64(sqrt(Float64(x + 1.0)) - sqrt(x))
end
↓
function code(x)
return sqrt((Float64(sqrt(x) + sqrt(Float64(1.0 + x))) ^ -2.0))
end
function tmp = code(x)
tmp = sqrt((x + 1.0)) - sqrt(x);
end
↓
function tmp = code(x)
tmp = sqrt(((sqrt(x) + sqrt((1.0 + x))) ^ -2.0));
end
code[x_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
↓
code[x_] := N[Sqrt[N[Power[N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]
\sqrt{x + 1} - \sqrt{x}
↓
\sqrt{{\left(\sqrt{x} + \sqrt{1 + x}\right)}^{-2}}
Alternatives
| Alternative 1 |
|---|
| Error | 0.6 |
|---|
| Cost | 26308 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{1 + x} - \sqrt{x}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-8}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.2 |
|---|
| Cost | 13248 |
|---|
\[\frac{1}{\sqrt{x} + \sqrt{1 + x}}
\]
| Alternative 3 |
|---|
| Error | 1.0 |
|---|
| Cost | 6980 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.004028897698743788:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 1.0 |
|---|
| Cost | 6980 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.004028897698743788:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 2.1 |
|---|
| Cost | 6852 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.004028897698743788:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 1.4 |
|---|
| Cost | 6852 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.004028897698743788:\\
\;\;\;\;\frac{1}{1 + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 31.4 |
|---|
| Cost | 64 |
|---|
\[1
\]