\[\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)\\
t_1 := \frac{x}{t_0}\\
\left(t_1 + \frac{y \cdot 2}{t_0}\right) \cdot \left(t_1 + \frac{y \cdot -2}{t_0}\right)
\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))) (t_1 (/ x t_0)))
(* (+ t_1 (/ (* y 2.0) t_0)) (+ t_1 (/ (* y -2.0) t_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));
double t_1 = x / t_0;
return (t_1 + ((y * 2.0) / t_0)) * (t_1 + ((y * -2.0) / t_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));
double t_1 = x / t_0;
return (t_1 + ((y * 2.0) / t_0)) * (t_1 + ((y * -2.0) / t_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))
t_1 = x / t_0
return (t_1 + ((y * 2.0) / t_0)) * (t_1 + ((y * -2.0) / t_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))
t_1 = Float64(x / t_0)
return Float64(Float64(t_1 + Float64(Float64(y * 2.0) / t_0)) * Float64(t_1 + Float64(Float64(y * -2.0) / t_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));
t_1 = x / t_0;
tmp = (t_1 + ((y * 2.0) / t_0)) * (t_1 + ((y * -2.0) / t_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]}, Block[{t$95$1 = N[(x / t$95$0), $MachinePrecision]}, N[(N[(t$95$1 + N[(N[(y * 2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + N[(N[(y * -2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $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)\\
t_1 := \frac{x}{t_0}\\
\left(t_1 + \frac{y \cdot 2}{t_0}\right) \cdot \left(t_1 + \frac{y \cdot -2}{t_0}\right)
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.2 |
|---|
| Cost | 20992 |
|---|
\[\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\left(\frac{x}{t_0} + \frac{y \cdot 2}{t_0}\right) \cdot \left(\frac{1}{t_0} \cdot \left(x - y \cdot 2\right)\right)
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.2 |
|---|
| Cost | 20864 |
|---|
\[\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\frac{1}{t_0} \cdot \left(\frac{x}{\frac{t_0}{x}} - \frac{y}{\frac{t_0}{y \cdot 4}}\right)
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.2 |
|---|
| Cost | 14272 |
|---|
\[\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\frac{\left(x - y \cdot 2\right) \cdot \left(\frac{1}{t_0} \cdot \left(x + y \cdot 2\right)\right)}{t_0}
\end{array}
\]
| Alternative 4 |
|---|
| Error | 12.1 |
|---|
| Cost | 8008 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-241}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+271}:\\
\;\;\;\;\frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 12.1 |
|---|
| Cost | 7496 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-241}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+271}:\\
\;\;\;\;\frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 12.7 |
|---|
| Cost | 7372 |
|---|
\[\begin{array}{l}
t_0 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
t_1 := 1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\
\mathbf{if}\;x \leq -7.8 \cdot 10^{+135}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-55}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 12.7 |
|---|
| Cost | 1744 |
|---|
\[\begin{array}{l}
t_0 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
t_1 := 1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\
\mathbf{if}\;x \leq -2.65 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-121}:\\
\;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{+103}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 16.3 |
|---|
| Cost | 969 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+42} \lor \neg \left(x \leq 1.65 \cdot 10^{-12}\right):\\
\;\;\;\;1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 16.0 |
|---|
| Cost | 969 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{+42} \lor \neg \left(x \leq 31000\right):\\
\;\;\;\;1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\
\mathbf{else}:\\
\;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 16.6 |
|---|
| Cost | 328 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{+43}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-12}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 31.7 |
|---|
| Cost | 64 |
|---|
\[-1
\]