\[\left(0 < x \land x < 1\right) \land y < 1\]
\[\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
\]
↓
\[\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}
\]
(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)) (+ (* x x) (* y y)))))
(if (<= t_0 2.0) t_0 (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)) / ((x * x) + (y * y));
double tmp;
if (t_0 <= 2.0) {
tmp = t_0;
} 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(Float64(x - y) * Float64(x + y)) / Float64(Float64(x * x) + Float64(y * y)))
tmp = 0.0
if (t_0 <= 2.0)
tmp = t_0;
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[(N[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2.0], t$95$0, 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 := \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}
Alternatives
| Alternative 1 |
|---|
| Accuracy | 92.6% |
|---|
| Cost | 1988 |
|---|
\[\begin{array}{l}
t_0 := \frac{x + y}{y}\\
t_1 := \frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\
\mathbf{if}\;t_1 \leq 2:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot t_0 - t_0\\
\end{array}
\]
| Alternative 2 |
|---|
| Accuracy | 91.2% |
|---|
| Cost | 1357 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-41}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -1.35 \cdot 10^{-161} \lor \neg \left(y \leq 1.55 \cdot 10^{-162}\right):\\
\;\;\;\;\left(x - y\right) \cdot \frac{x + y}{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} + \left(1 - \frac{y}{x}\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| Accuracy | 82.7% |
|---|
| Cost | 1028 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{-132}:\\
\;\;\;\;\frac{x + y}{\frac{-x}{\frac{y}{x}} - \left(x + y\right)}\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{-140}:\\
\;\;\;\;\frac{y}{x} + \left(1 - \frac{y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y} + 1}{\frac{y}{x - y}}\\
\end{array}
\]
| Alternative 4 |
|---|
| Accuracy | 82.7% |
|---|
| Cost | 969 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-133} \lor \neg \left(y \leq 2.05 \cdot 10^{-137}\right):\\
\;\;\;\;\frac{\frac{x}{y} + 1}{\frac{y}{x - y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} + \left(1 - \frac{y}{x}\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Accuracy | 82.7% |
|---|
| Cost | 968 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-133}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + -1\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{x} + \left(1 - \frac{y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{y} \cdot \frac{x - y}{y}\\
\end{array}
\]
| Alternative 6 |
|---|
| Accuracy | 82.5% |
|---|
| Cost | 841 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-131} \lor \neg \left(y \leq 1.05 \cdot 10^{-137}\right):\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + -1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
| Alternative 7 |
|---|
| Accuracy | 82.6% |
|---|
| Cost | 841 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-129} \lor \neg \left(y \leq 6.5 \cdot 10^{-138}\right):\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} + \left(1 - \frac{y}{x}\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Accuracy | 82.2% |
|---|
| Cost | 328 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-132}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 10^{-137}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 9 |
|---|
| Accuracy | 66.7% |
|---|
| Cost | 64 |
|---|
\[-1
\]