\[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}
\]
↓
\[\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
{\left(\frac{x}{t_0}\right)}^{2} - {\left(\frac{y \cdot 2}{t_0}\right)}^{2}
\end{array}
\]
(FPCore (x y)
:precision binary64
(/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))
↓
(FPCore (x y)
:precision binary64
(let* ((t_0 (hypot x (* y 2.0))))
(- (pow (/ x t_0) 2.0) (pow (/ (* y 2.0) t_0) 2.0))))
double code(double x, double y) {
return ((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y));
}
↓
double code(double x, double y) {
double t_0 = hypot(x, (y * 2.0));
return pow((x / t_0), 2.0) - pow(((y * 2.0) / t_0), 2.0);
}
public static double code(double x, double y) {
return ((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y));
}
↓
public static double code(double x, double y) {
double t_0 = Math.hypot(x, (y * 2.0));
return Math.pow((x / t_0), 2.0) - Math.pow(((y * 2.0) / t_0), 2.0);
}
def code(x, y):
return ((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y))
↓
def code(x, y):
t_0 = math.hypot(x, (y * 2.0))
return math.pow((x / t_0), 2.0) - math.pow(((y * 2.0) / t_0), 2.0)
function code(x, y)
return Float64(Float64(Float64(x * x) - Float64(Float64(y * 4.0) * y)) / Float64(Float64(x * x) + Float64(Float64(y * 4.0) * y)))
end
↓
function code(x, y)
t_0 = hypot(x, Float64(y * 2.0))
return Float64((Float64(x / t_0) ^ 2.0) - (Float64(Float64(y * 2.0) / t_0) ^ 2.0))
end
function tmp = code(x, y)
tmp = ((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y));
end
↓
function tmp = code(x, y)
t_0 = hypot(x, (y * 2.0));
tmp = ((x / t_0) ^ 2.0) - (((y * 2.0) / t_0) ^ 2.0);
end
code[x_, y_] := N[(N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[Power[N[(x / t$95$0), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(N[(y * 2.0), $MachinePrecision] / t$95$0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}
↓
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
{\left(\frac{x}{t_0}\right)}^{2} - {\left(\frac{y \cdot 2}{t_0}\right)}^{2}
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 19.97% |
|---|
| Cost | 8528 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{t_0 + x \cdot x}\\
\mathbf{if}\;t_0 \leq 10^{-225}:\\
\;\;\;\;\mathsf{fma}\left(-8, \frac{y}{x} \cdot \frac{y}{x}, 1\right)\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-163}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-107}:\\
\;\;\;\;1 + \left(\frac{y \cdot -4}{\frac{x}{\frac{y}{x}}} - \frac{y}{x \cdot \frac{x \cdot 0.25}{y}}\right)\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+219}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y} \cdot \frac{x}{y}, 0.5, -1\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 8.58% |
|---|
| Cost | 8528 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \mathsf{fma}\left(\frac{x}{y} \cdot \frac{x}{y}, 0.5, -1\right)\\
t_2 := \frac{x}{x + \frac{t_0}{x}} + \frac{y \cdot \left(y \cdot -4\right)}{\mathsf{fma}\left(x, x, t_0\right)}\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{+153}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -6.8 \cdot 10^{-127}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-163}:\\
\;\;\;\;1 + \left(\frac{y \cdot -4}{\frac{x}{\frac{y}{x}}} - \frac{y}{x \cdot \frac{x \cdot 0.25}{y}}\right)\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+89}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 20.32% |
|---|
| Cost | 7364 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{t_0 + x \cdot x}\\
\mathbf{if}\;t_0 \leq 10^{-225}:\\
\;\;\;\;\mathsf{fma}\left(-8, \frac{y}{x} \cdot \frac{y}{x}, 1\right)\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-163}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-107}:\\
\;\;\;\;1 + \left(\frac{y \cdot -4}{\frac{x}{\frac{y}{x}}} - \frac{y}{x \cdot \frac{x \cdot 0.25}{y}}\right)\\
\mathbf{elif}\;t_0 \leq 4 \cdot 10^{+221}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 20.47% |
|---|
| Cost | 2768 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{t_0 + x \cdot x}\\
\mathbf{if}\;t_0 \leq 10^{-225}:\\
\;\;\;\;1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-163}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-107}:\\
\;\;\;\;1\\
\mathbf{elif}\;t_0 \leq 4 \cdot 10^{+221}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 20.4% |
|---|
| Cost | 2768 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := 1 + \left(\frac{y \cdot -4}{\frac{x}{\frac{y}{x}}} - \frac{y}{x \cdot \frac{x \cdot 0.25}{y}}\right)\\
t_2 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{t_0 + x \cdot x}\\
\mathbf{if}\;t_0 \leq 10^{-225}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-163}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-107}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 4 \cdot 10^{+221}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 25.87% |
|---|
| Cost | 1869 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;t_0 \leq 10^{-101} \lor \neg \left(t_0 \leq 4 \cdot 10^{-61}\right) \land t_0 \leq 1:\\
\;\;\;\;1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 25.85% |
|---|
| Cost | 1868 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := 1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\
\mathbf{if}\;t_0 \leq 10^{-101}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 4 \cdot 10^{-61}:\\
\;\;\;\;\frac{y \cdot \left(y \cdot -4\right)}{t_0 + x \cdot x}\\
\mathbf{elif}\;t_0 \leq 1:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 26.08% |
|---|
| Cost | 328 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{-51}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 10^{-8}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 50.38% |
|---|
| Cost | 64 |
|---|
\[-1
\]