\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\]
↓
\[\frac{\frac{1}{1 + x}}{\sqrt{x} + x \cdot {\left(1 + x\right)}^{-0.5}}
\]
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
↓
(FPCore (x)
:precision binary64
(/ (/ 1.0 (+ 1.0 x)) (+ (sqrt x) (* x (pow (+ 1.0 x) -0.5)))))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
↓
double code(double x) {
return (1.0 / (1.0 + x)) / (sqrt(x) + (x * pow((1.0 + x), -0.5)));
}
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
code = (1.0d0 / (1.0d0 + x)) / (sqrt(x) + (x * ((1.0d0 + x) ** (-0.5d0))))
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) {
return (1.0 / (1.0 + x)) / (Math.sqrt(x) + (x * Math.pow((1.0 + x), -0.5)));
}
def code(x):
return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
↓
def code(x):
return (1.0 / (1.0 + x)) / (math.sqrt(x) + (x * math.pow((1.0 + x), -0.5)))
function code(x)
return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0))))
end
↓
function code(x)
return Float64(Float64(1.0 / Float64(1.0 + x)) / Float64(sqrt(x) + Float64(x * (Float64(1.0 + x) ^ -0.5))))
end
function tmp = code(x)
tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
end
↓
function tmp = code(x)
tmp = (1.0 / (1.0 + x)) / (sqrt(x) + (x * ((1.0 + x) ^ -0.5)));
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_] := N[(N[(1.0 / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[(x * N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
↓
\frac{\frac{1}{1 + x}}{\sqrt{x} + x \cdot {\left(1 + x\right)}^{-0.5}}
Alternatives
| Alternative 1 |
|---|
| Error | 0.6 |
|---|
| Cost | 26692 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 10^{-20}:\\
\;\;\;\;\frac{\frac{0.5}{x + -1}}{{x}^{0.5}}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.6 |
|---|
| Cost | 13696 |
|---|
\[\frac{1}{\left(1 + x\right) \cdot \left(\sqrt{x} + x \cdot {\left(1 + x\right)}^{-0.5}\right)}
\]
| Alternative 3 |
|---|
| Error | 1.3 |
|---|
| Cost | 7172 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.2:\\
\;\;\;\;{x}^{-0.5} - \frac{1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(1 + x\right) \cdot \left(\sqrt{x} \cdot 2\right)}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 1.0 |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;-1 + \left({x}^{-0.5} + x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \left(0.5 \cdot \sqrt{\frac{1}{x}}\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 1.0 |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;-1 + \left({x}^{-0.5} + x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sqrt{x} \cdot -2} \cdot \frac{1}{x}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 1.3 |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.68:\\
\;\;\;\;-1 + \left({x}^{-0.5} + x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(1 + x\right) \cdot \left(\sqrt{x} \cdot 2\right)}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 20.8 |
|---|
| Cost | 7044 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 8 \cdot 10^{+76}:\\
\;\;\;\;-1 + \left({x}^{-0.5} + x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(-1 - {x}^{-0.5}\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 21.3 |
|---|
| Cost | 6916 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 4:\\
\;\;\;\;-1 + {x}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(-1 - {x}^{-0.5}\right)\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 32.0 |
|---|
| Cost | 6656 |
|---|
\[-1 + {x}^{-0.5}
\]
| Alternative 10 |
|---|
| Error | 62.6 |
|---|
| Cost | 6592 |
|---|
\[-{x}^{-0.5}
\]