\[\left(0 < x \land x < 1\right) \land y < 1\]
Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
\]
↓
\[\begin{array}{l}
t_0 := \frac{y}{x} \cdot \frac{y}{x}\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{-203} \lor \neg \left(y \leq 1.8 \cdot 10^{-243}\right):\\
\;\;\;\;\frac{x - y}{y \cdot \frac{y}{y + x} + \frac{1}{y + x} \cdot \left(x \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \frac{y}{x}\right) - t_0\right) + \left(\frac{y}{x} - t_0\right)\\
\end{array}
\]
(FPCore (x y) :precision binary64 (/ (* (- x y) (+ x y)) (+ (* x x) (* y y)))) ↓
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ y x) (/ y x))))
(if (or (<= y -1.45e-203) (not (<= y 1.8e-243)))
(/ (- x y) (+ (* y (/ y (+ y x))) (* (/ 1.0 (+ y x)) (* x x))))
(+ (- (- 1.0 (/ y x)) t_0) (- (/ y x) t_0))))) double code(double x, double y) {
return ((x - y) * (x + y)) / ((x * x) + (y * y));
}
↓
double code(double x, double y) {
double t_0 = (y / x) * (y / x);
double tmp;
if ((y <= -1.45e-203) || !(y <= 1.8e-243)) {
tmp = (x - y) / ((y * (y / (y + x))) + ((1.0 / (y + x)) * (x * x)));
} else {
tmp = ((1.0 - (y / x)) - t_0) + ((y / x) - t_0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x - y) * (x + y)) / ((x * x) + (y * y))
end function
↓
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y / x) * (y / x)
if ((y <= (-1.45d-203)) .or. (.not. (y <= 1.8d-243))) then
tmp = (x - y) / ((y * (y / (y + x))) + ((1.0d0 / (y + x)) * (x * x)))
else
tmp = ((1.0d0 - (y / x)) - t_0) + ((y / x) - t_0)
end if
code = tmp
end function
public static double code(double x, double y) {
return ((x - y) * (x + y)) / ((x * x) + (y * y));
}
↓
public static double code(double x, double y) {
double t_0 = (y / x) * (y / x);
double tmp;
if ((y <= -1.45e-203) || !(y <= 1.8e-243)) {
tmp = (x - y) / ((y * (y / (y + x))) + ((1.0 / (y + x)) * (x * x)));
} else {
tmp = ((1.0 - (y / x)) - t_0) + ((y / x) - t_0);
}
return tmp;
}
def code(x, y):
return ((x - y) * (x + y)) / ((x * x) + (y * y))
↓
def code(x, y):
t_0 = (y / x) * (y / x)
tmp = 0
if (y <= -1.45e-203) or not (y <= 1.8e-243):
tmp = (x - y) / ((y * (y / (y + x))) + ((1.0 / (y + x)) * (x * x)))
else:
tmp = ((1.0 - (y / x)) - t_0) + ((y / x) - t_0)
return tmp
function code(x, y)
return Float64(Float64(Float64(x - y) * Float64(x + y)) / Float64(Float64(x * x) + Float64(y * y)))
end
↓
function code(x, y)
t_0 = Float64(Float64(y / x) * Float64(y / x))
tmp = 0.0
if ((y <= -1.45e-203) || !(y <= 1.8e-243))
tmp = Float64(Float64(x - y) / Float64(Float64(y * Float64(y / Float64(y + x))) + Float64(Float64(1.0 / Float64(y + x)) * Float64(x * x))));
else
tmp = Float64(Float64(Float64(1.0 - Float64(y / x)) - t_0) + Float64(Float64(y / x) - t_0));
end
return tmp
end
function tmp = code(x, y)
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y));
end
↓
function tmp_2 = code(x, y)
t_0 = (y / x) * (y / x);
tmp = 0.0;
if ((y <= -1.45e-203) || ~((y <= 1.8e-243)))
tmp = (x - y) / ((y * (y / (y + x))) + ((1.0 / (y + x)) * (x * x)));
else
tmp = ((1.0 - (y / x)) - t_0) + ((y / x) - t_0);
end
tmp_2 = tmp;
end
code[x_, y_] := N[(N[(N[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y, -1.45e-203], N[Not[LessEqual[y, 1.8e-243]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] / N[(N[(y * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(y / x), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision] + N[(N[(y / x), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]]]
\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
↓
\begin{array}{l}
t_0 := \frac{y}{x} \cdot \frac{y}{x}\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{-203} \lor \neg \left(y \leq 1.8 \cdot 10^{-243}\right):\\
\;\;\;\;\frac{x - y}{y \cdot \frac{y}{y + x} + \frac{1}{y + x} \cdot \left(x \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \frac{y}{x}\right) - t_0\right) + \left(\frac{y}{x} - t_0\right)\\
\end{array}
Alternatives Alternative 1 Error 2.8 Cost 1609
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-203} \lor \neg \left(y \leq 1.6 \cdot 10^{-243}\right):\\
\;\;\;\;\frac{x - y}{y \cdot \frac{y}{y + x} + \frac{1}{y + x} \cdot \left(x \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} + \left(1 - \frac{y}{x}\right)\\
\end{array}
\]
Alternative 2 Error 5.0 Cost 1357
\[\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-162} \lor \neg \left(y \leq 1.38 \cdot 10^{-163}\right):\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(y + x\right)}{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} + \left(1 - \frac{y}{x}\right)\\
\end{array}
\]
Alternative 3 Error 4.8 Cost 1357
\[\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-162} \lor \neg \left(y \leq 1.38 \cdot 10^{-163}\right):\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(y + x\right)}{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{\left(x - y\right) + \frac{y + y}{\frac{x}{y}}}\\
\end{array}
\]
Alternative 4 Error 11.3 Cost 841
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-123} \lor \neg \left(y \leq 7.2 \cdot 10^{-177}\right):\\
\;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
Alternative 5 Error 11.2 Cost 841
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-123} \lor \neg \left(y \leq 3.4 \cdot 10^{-176}\right):\\
\;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} + \left(1 - \frac{y}{x}\right)\\
\end{array}
\]
Alternative 6 Error 11.4 Cost 328
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-123}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-153}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
Alternative 7 Error 21.6 Cost 64
\[-1
\]