\[\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}
\]
↓
\[\begin{array}{l}
t_0 := \sqrt{x \cdot x - \varepsilon}\\
\mathbf{if}\;\sqrt{-\varepsilon} \ne 0:\\
\;\;\;\;\frac{\varepsilon}{x + t_0}\\
\mathbf{else}:\\
\;\;\;\;x - t_0\\
\end{array}
\]
(FPCore (x eps) :precision binary64 (- x (sqrt (- (* x x) eps))))
↓
(FPCore (x eps)
:precision binary64
(let* ((t_0 (sqrt (- (* x x) eps))))
(if (!= (sqrt (- eps)) 0.0) (/ eps (+ x t_0)) (- x t_0))))
double code(double x, double eps) {
return x - sqrt(((x * x) - eps));
}
↓
double code(double x, double eps) {
double t_0 = sqrt(((x * x) - eps));
double tmp;
if (sqrt(-eps) != 0.0) {
tmp = eps / (x + t_0);
} else {
tmp = x - t_0;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((x * x) - eps))
if (sqrt(-eps) /= 0.0d0) then
tmp = eps / (x + t_0)
else
tmp = x - t_0
end if
code = tmp
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) {
double t_0 = Math.sqrt(((x * x) - eps));
double tmp;
if (Math.sqrt(-eps) != 0.0) {
tmp = eps / (x + t_0);
} else {
tmp = x - t_0;
}
return tmp;
}
def code(x, eps):
return x - math.sqrt(((x * x) - eps))
↓
def code(x, eps):
t_0 = math.sqrt(((x * x) - eps))
tmp = 0
if math.sqrt(-eps) != 0.0:
tmp = eps / (x + t_0)
else:
tmp = x - t_0
return tmp
function code(x, eps)
return Float64(x - sqrt(Float64(Float64(x * x) - eps)))
end
↓
function code(x, eps)
t_0 = sqrt(Float64(Float64(x * x) - eps))
tmp = 0.0
if (sqrt(Float64(-eps)) != 0.0)
tmp = Float64(eps / Float64(x + t_0));
else
tmp = Float64(x - t_0);
end
return tmp
end
function tmp = code(x, eps)
tmp = x - sqrt(((x * x) - eps));
end
↓
function tmp_2 = code(x, eps)
t_0 = sqrt(((x * x) - eps));
tmp = 0.0;
if (sqrt(-eps) ~= 0.0)
tmp = eps / (x + t_0);
else
tmp = x - t_0;
end
tmp_2 = tmp;
end
code[x_, eps_] := N[(x - N[Sqrt[N[(N[(x * x), $MachinePrecision] - eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[x_, eps_] := Block[{t$95$0 = N[Sqrt[N[(N[(x * x), $MachinePrecision] - eps), $MachinePrecision]], $MachinePrecision]}, If[Unequal[N[Sqrt[(-eps)], $MachinePrecision], 0.0], N[(eps / N[(x + t$95$0), $MachinePrecision]), $MachinePrecision], N[(x - t$95$0), $MachinePrecision]]]
x - \sqrt{x \cdot x - \varepsilon}
↓
\begin{array}{l}
t_0 := \sqrt{x \cdot x - \varepsilon}\\
\mathbf{if}\;\sqrt{-\varepsilon} \ne 0:\\
\;\;\;\;\frac{\varepsilon}{x + t_0}\\
\mathbf{else}:\\
\;\;\;\;x - t_0\\
\end{array}