\[\left(0 \leq x \land x \leq 1000000000\right) \land \left(-1 \leq \varepsilon \land \varepsilon \leq 1\right)\]
\[x - \sqrt{x \cdot x - \varepsilon}
\]
↓
\[\frac{\left(x \cdot x - x \cdot x\right) + \varepsilon}{x + \sqrt{x \cdot x - \varepsilon}}
\]
(FPCore (x eps) :precision binary64 (- x (sqrt (- (* x x) eps))))
↓
(FPCore (x eps)
:precision binary64
(/ (+ (- (* x x) (* x x)) eps) (+ x (sqrt (- (* x x) eps)))))
double code(double x, double eps) {
return x - sqrt(((x * x) - eps));
}
↓
double code(double x, double eps) {
return (((x * x) - (x * x)) + eps) / (x + sqrt(((x * x) - eps)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = x - sqrt(((x * x) - eps))
end function
↓
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((x * x) - (x * x)) + eps) / (x + sqrt(((x * x) - eps)))
end function
public static double code(double x, double eps) {
return x - Math.sqrt(((x * x) - eps));
}
↓
public static double code(double x, double eps) {
return (((x * x) - (x * x)) + eps) / (x + Math.sqrt(((x * x) - eps)));
}
def code(x, eps):
return x - math.sqrt(((x * x) - eps))
↓
def code(x, eps):
return (((x * x) - (x * x)) + eps) / (x + math.sqrt(((x * x) - eps)))
function code(x, eps)
return Float64(x - sqrt(Float64(Float64(x * x) - eps)))
end
↓
function code(x, eps)
return Float64(Float64(Float64(Float64(x * x) - Float64(x * x)) + eps) / Float64(x + sqrt(Float64(Float64(x * x) - eps))))
end
function tmp = code(x, eps)
tmp = x - sqrt(((x * x) - eps));
end
↓
function tmp = code(x, eps)
tmp = (((x * x) - (x * x)) + eps) / (x + sqrt(((x * x) - eps)));
end
code[x_, eps_] := N[(x - N[Sqrt[N[(N[(x * x), $MachinePrecision] - eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[x_, eps_] := N[(N[(N[(N[(x * x), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision] + eps), $MachinePrecision] / N[(x + N[Sqrt[N[(N[(x * x), $MachinePrecision] - eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x - \sqrt{x \cdot x - \varepsilon}
↓
\frac{\left(x \cdot x - x \cdot x\right) + \varepsilon}{x + \sqrt{x \cdot x - \varepsilon}}
Alternatives
| Alternative 1 |
|---|
| Error | 0.8 |
|---|
| Cost | 13764 |
|---|
\[\begin{array}{l}
t_0 := x - \sqrt{x \cdot x - \varepsilon}\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{-154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot x - x \cdot x\right) + \varepsilon}{x + \left(x + -0.5 \cdot \frac{\varepsilon}{x}\right)}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 9.8 |
|---|
| Cost | 7316 |
|---|
\[\begin{array}{l}
t_0 := x - \sqrt{-\varepsilon}\\
t_1 := \frac{\left(x \cdot x - x \cdot x\right) + \varepsilon}{x + \left(x + -0.5 \cdot \frac{\varepsilon}{x}\right)}\\
\mathbf{if}\;x \leq 7.2 \cdot 10^{-115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-99}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-87}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.0160653848447498 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.10015178853059 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 35.2 |
|---|
| Cost | 1216 |
|---|
\[\frac{\left(x \cdot x - x \cdot x\right) + \varepsilon}{x + \left(x + -0.5 \cdot \frac{\varepsilon}{x}\right)}
\]
| Alternative 4 |
|---|
| Error | 35.3 |
|---|
| Cost | 704 |
|---|
\[\frac{1}{\frac{-0.5}{x} + 2 \cdot \frac{x}{\varepsilon}}
\]
| Alternative 5 |
|---|
| Error | 35.8 |
|---|
| Cost | 320 |
|---|
\[\frac{0.5}{\frac{x}{\varepsilon}}
\]
| Alternative 6 |
|---|
| Error | 35.7 |
|---|
| Cost | 320 |
|---|
\[\frac{\varepsilon}{x} \cdot 0.5
\]
| Alternative 7 |
|---|
| Error | 56.7 |
|---|
| Cost | 192 |
|---|
\[\frac{\varepsilon}{x}
\]
| Alternative 8 |
|---|
| Error | 61.8 |
|---|
| Cost | 64 |
|---|
\[x
\]