\[\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 := \frac{y}{y + 0.25 \cdot \left(x \cdot \frac{x}{y}\right)}\\
t_1 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+289}:\\
\;\;\;\;\frac{1}{t_1} \cdot \frac{x \cdot x}{t_1} - t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{y}{x} \cdot \frac{y}{x}, 1\right) - t_0\\
\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 (/ y (+ y (* 0.25 (* x (/ x y)))))) (t_1 (hypot x (* y 2.0))))
(if (<= (* x x) 5e+289)
(- (* (/ 1.0 t_1) (/ (* x x) t_1)) t_0)
(- (fma -4.0 (* (/ y x) (/ y x)) 1.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 = y / (y + (0.25 * (x * (x / y))));
double t_1 = hypot(x, (y * 2.0));
double tmp;
if ((x * x) <= 5e+289) {
tmp = ((1.0 / t_1) * ((x * x) / t_1)) - t_0;
} else {
tmp = fma(-4.0, ((y / x) * (y / x)), 1.0) - t_0;
}
return tmp;
}
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 = Float64(y / Float64(y + Float64(0.25 * Float64(x * Float64(x / y)))))
t_1 = hypot(x, Float64(y * 2.0))
tmp = 0.0
if (Float64(x * x) <= 5e+289)
tmp = Float64(Float64(Float64(1.0 / t_1) * Float64(Float64(x * x) / t_1)) - t_0);
else
tmp = Float64(fma(-4.0, Float64(Float64(y / x) * Float64(y / x)), 1.0) - t_0);
end
return tmp
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[(y / N[(y + N[(0.25 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e+289], N[(N[(N[(1.0 / t$95$1), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(-4.0 * N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $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 := \frac{y}{y + 0.25 \cdot \left(x \cdot \frac{x}{y}\right)}\\
t_1 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+289}:\\
\;\;\;\;\frac{1}{t_1} \cdot \frac{x \cdot x}{t_1} - t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{y}{x} \cdot \frac{y}{x}, 1\right) - t_0\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 12.3 |
|---|
| Cost | 8140 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\
t_2 := x \cdot \left(\frac{x}{y} \cdot \frac{0.5}{y}\right) + -1\\
\mathbf{if}\;y \leq -1.0940465293235568 \cdot 10^{+99}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.5985860938331456 \cdot 10^{-63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.747370275977222 \cdot 10^{-91}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{y}{x} \cdot \frac{y}{x}, 1\right) - \frac{y}{y + 0.25 \cdot \left(x \cdot \frac{x}{y}\right)}\\
\mathbf{elif}\;y \leq 8.911105642492523 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 5.9 |
|---|
| Cost | 8132 |
|---|
\[\begin{array}{l}
t_0 := \frac{y}{y + 0.25 \cdot \left(x \cdot \frac{x}{y}\right)}\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+289}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)} - t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{y}{x} \cdot \frac{y}{x}, 1\right) - t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 12.3 |
|---|
| Cost | 7308 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\
t_2 := x \cdot \left(\frac{x}{y} \cdot \frac{0.5}{y}\right) + -1\\
\mathbf{if}\;y \leq -1.0940465293235568 \cdot 10^{+99}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.5985860938331456 \cdot 10^{-63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.747370275977222 \cdot 10^{-91}:\\
\;\;\;\;1 + -8 \cdot {\left(\frac{x}{y}\right)}^{-2}\\
\mathbf{elif}\;y \leq 8.911105642492523 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 17.0 |
|---|
| Cost | 1868 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := x \cdot \left(\frac{x}{y} \cdot \frac{0.5}{y}\right) + -1\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{-169}:\\
\;\;\;\;1 + y \cdot \left(-8 \cdot \frac{\frac{y}{x}}{x}\right)\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+179}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 12.4 |
|---|
| Cost | 1744 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\
t_2 := x \cdot \left(\frac{x}{y} \cdot \frac{0.5}{y}\right) + -1\\
\mathbf{if}\;y \leq -1.0940465293235568 \cdot 10^{+99}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.5985860938331456 \cdot 10^{-63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.747370275977222 \cdot 10^{-91}:\\
\;\;\;\;1 + y \cdot \left(-8 \cdot \frac{\frac{y}{x}}{x}\right)\\
\mathbf{elif}\;y \leq 8.911105642492523 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 16.8 |
|---|
| Cost | 968 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.5985860938331456 \cdot 10^{-63}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 4.747370275977222 \cdot 10^{-91}:\\
\;\;\;\;1 + y \cdot \left(-8 \cdot \frac{\frac{y}{x}}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 17.0 |
|---|
| Cost | 328 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.5985860938331456 \cdot 10^{-63}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 4.2224998622300256 \cdot 10^{-92}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 31.8 |
|---|
| Cost | 64 |
|---|
\[1
\]