Math FPCore C Julia Wolfram TeX \[\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 := y \cdot \left(y \cdot 4\right)\\
t_1 := x \cdot x + t_0\\
t_2 := \frac{x \cdot x - t_0}{t_1}\\
t_3 := \frac{x}{y} \cdot \frac{x}{y}\\
t_4 := \mathsf{fma}\left(0.5, t_3, -1\right)\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)}{t_1}\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;\mathsf{fma}\left(0.25, t_3, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{y}{x}\right)}\right)}^{4}, \sqrt[3]{1 + {\left(\frac{y}{x}\right)}^{2}}, -1\right), -8, 1\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 (* y (* y 4.0)))
(t_1 (+ (* x x) t_0))
(t_2 (/ (- (* x x) t_0) t_1))
(t_3 (* (/ x y) (/ x y)))
(t_4 (fma 0.5 t_3 -1.0)))
(if (<= (* x x) 2e-294)
t_4
(if (<= (* x x) 2e-205)
t_2
(if (<= (* x x) 4e-23)
t_4
(if (<= (* x x) 5e+164)
(/ (fma x x (* y (* y -4.0))) t_1)
(if (<= (* x x) 2e+192)
(fma 0.25 t_3 -1.0)
(if (<= (* x x) 2e+218)
t_2
(fma
(fma
(pow (cbrt (hypot 1.0 (/ y x))) 4.0)
(cbrt (+ 1.0 (pow (/ y x) 2.0)))
-1.0)
-8.0
1.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 * 4.0);
double t_1 = (x * x) + t_0;
double t_2 = ((x * x) - t_0) / t_1;
double t_3 = (x / y) * (x / y);
double t_4 = fma(0.5, t_3, -1.0);
double tmp;
if ((x * x) <= 2e-294) {
tmp = t_4;
} else if ((x * x) <= 2e-205) {
tmp = t_2;
} else if ((x * x) <= 4e-23) {
tmp = t_4;
} else if ((x * x) <= 5e+164) {
tmp = fma(x, x, (y * (y * -4.0))) / t_1;
} else if ((x * x) <= 2e+192) {
tmp = fma(0.25, t_3, -1.0);
} else if ((x * x) <= 2e+218) {
tmp = t_2;
} else {
tmp = fma(fma(pow(cbrt(hypot(1.0, (y / x))), 4.0), cbrt((1.0 + pow((y / x), 2.0))), -1.0), -8.0, 1.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 * 4.0))
t_1 = Float64(Float64(x * x) + t_0)
t_2 = Float64(Float64(Float64(x * x) - t_0) / t_1)
t_3 = Float64(Float64(x / y) * Float64(x / y))
t_4 = fma(0.5, t_3, -1.0)
tmp = 0.0
if (Float64(x * x) <= 2e-294)
tmp = t_4;
elseif (Float64(x * x) <= 2e-205)
tmp = t_2;
elseif (Float64(x * x) <= 4e-23)
tmp = t_4;
elseif (Float64(x * x) <= 5e+164)
tmp = Float64(fma(x, x, Float64(y * Float64(y * -4.0))) / t_1);
elseif (Float64(x * x) <= 2e+192)
tmp = fma(0.25, t_3, -1.0);
elseif (Float64(x * x) <= 2e+218)
tmp = t_2;
else
tmp = fma(fma((cbrt(hypot(1.0, Float64(y / x))) ^ 4.0), cbrt(Float64(1.0 + (Float64(y / x) ^ 2.0))), -1.0), -8.0, 1.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 * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(0.5 * t$95$3 + -1.0), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 2e-294], t$95$4, If[LessEqual[N[(x * x), $MachinePrecision], 2e-205], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 4e-23], t$95$4, If[LessEqual[N[(x * x), $MachinePrecision], 5e+164], N[(N[(x * x + N[(y * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+192], N[(0.25 * t$95$3 + -1.0), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+218], t$95$2, N[(N[(N[Power[N[Power[N[Sqrt[1.0 ^ 2 + N[(y / x), $MachinePrecision] ^ 2], $MachinePrecision], 1/3], $MachinePrecision], 4.0], $MachinePrecision] * N[Power[N[(1.0 + N[Power[N[(y / x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + -1.0), $MachinePrecision] * -8.0 + 1.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 := y \cdot \left(y \cdot 4\right)\\
t_1 := x \cdot x + t_0\\
t_2 := \frac{x \cdot x - t_0}{t_1}\\
t_3 := \frac{x}{y} \cdot \frac{x}{y}\\
t_4 := \mathsf{fma}\left(0.5, t_3, -1\right)\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)}{t_1}\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;\mathsf{fma}\left(0.25, t_3, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{y}{x}\right)}\right)}^{4}, \sqrt[3]{1 + {\left(\frac{y}{x}\right)}^{2}}, -1\right), -8, 1\right)\\
\end{array}
Alternatives Alternative 1 Error 14.0 Cost 15000
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := x \cdot x + t_0\\
t_2 := \frac{x \cdot x - t_0}{t_1}\\
t_3 := \frac{x}{y} \cdot \frac{x}{y}\\
t_4 := \mathsf{fma}\left(0.5, t_3, -1\right)\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)}{t_1}\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;\mathsf{fma}\left(0.25, t_3, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-1 + \left(1 + {\left(\frac{y}{x}\right)}^{2}\right), -8, 1\right)\\
\end{array}
\]
Alternative 2 Error 14.0 Cost 8536
\[\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 := \frac{x}{y} \cdot \frac{x}{y}\\
t_3 := \mathsf{fma}\left(0.5, t_2, -1\right)\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;\mathsf{fma}\left(0.25, t_2, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\
\end{array}
\]
Alternative 3 Error 14.0 Cost 8536
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := x \cdot x + t_0\\
t_2 := \frac{x \cdot x - t_0}{t_1}\\
t_3 := \frac{x}{y} \cdot \frac{x}{y}\\
t_4 := \mathsf{fma}\left(0.5, t_3, -1\right)\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)}{t_1}\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;\mathsf{fma}\left(0.25, t_3, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\
\end{array}
\]
Alternative 4 Error 14.1 Cost 8276
\[\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 := \frac{x}{y} \cdot \frac{x}{y}\\
t_3 := \mathsf{fma}\left(0.5, t_2, -1\right)\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;\mathsf{fma}\left(0.25, t_2, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-4 \cdot \frac{y}{\frac{x}{y}}}{x}\\
\end{array}
\]
Alternative 5 Error 12.2 Cost 7504
\[\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \mathsf{fma}\left(0.25, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
t_2 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\
\mathbf{if}\;y \leq -4.5 \cdot 10^{+81}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3.1 \cdot 10^{-154}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-162}:\\
\;\;\;\;1 + \frac{-4 \cdot \frac{y}{\frac{x}{y}}}{x}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+33}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Error 14.3 Cost 2776
\[\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}\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-4 \cdot \frac{y}{\frac{x}{y}}}{x}\\
\end{array}
\]
Alternative 7 Error 16.9 Cost 1484
\[\begin{array}{l}
t_0 := 1 + \frac{-4 \cdot \frac{y}{\frac{x}{y}}}{x}\\
\mathbf{if}\;x \cdot x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 8 Error 17.0 Cost 1224
\[\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4.8 \cdot 10^{-23}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 2.5 \cdot 10^{+165}:\\
\;\;\;\;1 + -4 \cdot \frac{y \cdot y}{x \cdot x}\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
Alternative 9 Error 16.7 Cost 328
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-31}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+41}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
Alternative 10 Error 31.7 Cost 64
\[-1
\]