\[\left(0 < x \land x < 1\right) \land y < 1\]
Math FPCore C Julia Wolfram TeX \[\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
\]
↓
\[\begin{array}{l}
t_0 := \left(x - y\right) \cdot \left(x + y\right)\\
\mathbf{if}\;\frac{t_0}{x \cdot x + y \cdot y} \leq 2:\\
\;\;\;\;\frac{t_0}{\mathsf{fma}\left(x, x, y \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\end{array}
\]
(FPCore (x y) :precision binary64 (/ (* (- x y) (+ x y)) (+ (* x x) (* y y)))) ↓
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (- x y) (+ x y))))
(if (<= (/ t_0 (+ (* x x) (* y y))) 2.0)
(/ t_0 (fma x x (* y y)))
(fma 2.0 (* (/ x y) (/ x y)) -1.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 = (x - y) * (x + y);
double tmp;
if ((t_0 / ((x * x) + (y * y))) <= 2.0) {
tmp = t_0 / fma(x, x, (y * y));
} else {
tmp = fma(2.0, ((x / y) * (x / y)), -1.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(x - y) * Float64(x + y))
tmp = 0.0
if (Float64(t_0 / Float64(Float64(x * x) + Float64(y * y))) <= 2.0)
tmp = Float64(t_0 / fma(x, x, Float64(y * y)));
else
tmp = fma(2.0, Float64(Float64(x / y) * Float64(x / y)), -1.0);
end
return 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[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], N[(t$95$0 / N[(x * x + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]
\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
↓
\begin{array}{l}
t_0 := \left(x - y\right) \cdot \left(x + y\right)\\
\mathbf{if}\;\frac{t_0}{x \cdot x + y \cdot y} \leq 2:\\
\;\;\;\;\frac{t_0}{\mathsf{fma}\left(x, x, y \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\end{array}
Alternatives Alternative 1 Error 4.9 Cost 8004
\[\begin{array}{l}
t_0 := \frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\
\mathbf{if}\;t_0 \leq 2:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\end{array}
\]
Alternative 2 Error 5.0 Cost 1988
\[\begin{array}{l}
t_0 := \frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\
\mathbf{if}\;t_0 \leq 2:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + y}{y}}{\frac{y}{x - y}}\\
\end{array}
\]
Alternative 3 Error 11.1 Cost 1096
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-122}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + -1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-137}:\\
\;\;\;\;1 + \frac{y \cdot -2}{x} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y \cdot \frac{y}{x - y}}{x + y}}\\
\end{array}
\]
Alternative 4 Error 11.1 Cost 968
\[\begin{array}{l}
t_0 := \frac{x}{y} \cdot \frac{x}{y} + -1\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{-123}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 10^{-136}:\\
\;\;\;\;1 + \frac{y \cdot -2}{x} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 5 Error 11.6 Cost 840
\[\begin{array}{l}
t_0 := \frac{x}{y} \cdot \frac{x}{y} + -1\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{-123}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-137}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 6 Error 11.5 Cost 840
\[\begin{array}{l}
t_0 := \frac{x}{y} \cdot \frac{x}{y} + -1\\
\mathbf{if}\;y \leq -2.3 \cdot 10^{-123}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-137}:\\
\;\;\;\;\frac{y}{x} + \left(1 - \frac{y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 7 Error 11.3 Cost 840
\[\begin{array}{l}
t_0 := \frac{x}{y} \cdot \frac{x}{y} + -1\\
\mathbf{if}\;y \leq -1.6 \cdot 10^{-122}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-137}:\\
\;\;\;\;1 - \frac{y \cdot \frac{y}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 8 Error 11.8 Cost 328
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{-123}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-134}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
Alternative 9 Error 22.0 Cost 64
\[-1
\]