\[\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}
\mathbf{if}\;x - \sqrt{x \cdot x - \varepsilon} \leq -2 \cdot 10^{-153}:\\
\;\;\;\;x - \sqrt{\left(x \cdot x + \varepsilon \cdot -2\right) + \varepsilon}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\varepsilon}{x}\\
\end{array}
\]
(FPCore (x eps) :precision binary64 (- x (sqrt (- (* x x) eps))))
↓
(FPCore (x eps)
:precision binary64
(if (<= (- x (sqrt (- (* x x) eps))) -2e-153)
(- x (sqrt (+ (+ (* x x) (* eps -2.0)) eps)))
(* 0.5 (/ eps x))))
double code(double x, double eps) {
return x - sqrt(((x * x) - eps));
}
↓
double code(double x, double eps) {
double tmp;
if ((x - sqrt(((x * x) - eps))) <= -2e-153) {
tmp = x - sqrt((((x * x) + (eps * -2.0)) + eps));
} else {
tmp = 0.5 * (eps / x);
}
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) :: tmp
if ((x - sqrt(((x * x) - eps))) <= (-2d-153)) then
tmp = x - sqrt((((x * x) + (eps * (-2.0d0))) + eps))
else
tmp = 0.5d0 * (eps / x)
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 tmp;
if ((x - Math.sqrt(((x * x) - eps))) <= -2e-153) {
tmp = x - Math.sqrt((((x * x) + (eps * -2.0)) + eps));
} else {
tmp = 0.5 * (eps / x);
}
return tmp;
}
def code(x, eps):
return x - math.sqrt(((x * x) - eps))
↓
def code(x, eps):
tmp = 0
if (x - math.sqrt(((x * x) - eps))) <= -2e-153:
tmp = x - math.sqrt((((x * x) + (eps * -2.0)) + eps))
else:
tmp = 0.5 * (eps / x)
return tmp
function code(x, eps)
return Float64(x - sqrt(Float64(Float64(x * x) - eps)))
end
↓
function code(x, eps)
tmp = 0.0
if (Float64(x - sqrt(Float64(Float64(x * x) - eps))) <= -2e-153)
tmp = Float64(x - sqrt(Float64(Float64(Float64(x * x) + Float64(eps * -2.0)) + eps)));
else
tmp = Float64(0.5 * Float64(eps / x));
end
return tmp
end
function tmp = code(x, eps)
tmp = x - sqrt(((x * x) - eps));
end
↓
function tmp_2 = code(x, eps)
tmp = 0.0;
if ((x - sqrt(((x * x) - eps))) <= -2e-153)
tmp = x - sqrt((((x * x) + (eps * -2.0)) + eps));
else
tmp = 0.5 * (eps / x);
end
tmp_2 = tmp;
end
code[x_, eps_] := N[(x - N[Sqrt[N[(N[(x * x), $MachinePrecision] - eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[x_, eps_] := If[LessEqual[N[(x - N[Sqrt[N[(N[(x * x), $MachinePrecision] - eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -2e-153], N[(x - N[Sqrt[N[(N[(N[(x * x), $MachinePrecision] + N[(eps * -2.0), $MachinePrecision]), $MachinePrecision] + eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(eps / x), $MachinePrecision]), $MachinePrecision]]
x - \sqrt{x \cdot x - \varepsilon}
↓
\begin{array}{l}
\mathbf{if}\;x - \sqrt{x \cdot x - \varepsilon} \leq -2 \cdot 10^{-153}:\\
\;\;\;\;x - \sqrt{\left(x \cdot x + \varepsilon \cdot -2\right) + \varepsilon}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\varepsilon}{x}\\
\end{array}