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}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+299}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)} - \frac{y}{\mathsf{fma}\left(0.25, \frac{x \cdot x}{y}, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -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
(if (<= (* x x) 5e+299)
(- (/ (* x x) (fma x x (* y (* y 4.0)))) (/ y (fma 0.25 (/ (* x x) y) y)))
(fma (* (/ y x) (/ y x)) -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 tmp;
if ((x * x) <= 5e+299) {
tmp = ((x * x) / fma(x, x, (y * (y * 4.0)))) - (y / fma(0.25, ((x * x) / y), y));
} else {
tmp = fma(((y / x) * (y / x)), -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)
tmp = 0.0
if (Float64(x * x) <= 5e+299)
tmp = Float64(Float64(Float64(x * x) / fma(x, x, Float64(y * Float64(y * 4.0)))) - Float64(y / fma(0.25, Float64(Float64(x * x) / y), y)));
else
tmp = fma(Float64(Float64(y / x) * Float64(y / x)), -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_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e+299], N[(N[(N[(x * x), $MachinePrecision] / N[(x * x + N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[(0.25 * N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $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}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+299}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)} - \frac{y}{\mathsf{fma}\left(0.25, \frac{x \cdot x}{y}, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\
\end{array}
Alternatives Alternative 1 Error 13.3 Cost 7504
\[\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\
t_1 := \frac{x \cdot \frac{x}{y}}{y \cdot 2} + -1\\
t_2 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{+121}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{+57}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-144}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-123}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+66}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 2 Error 13.4 Cost 1876
\[\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 := \frac{x \cdot \frac{x}{y}}{y \cdot 2} + -1\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{+121}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{+57}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-143}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-122}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+66}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Error 16.4 Cost 1232
\[\begin{array}{l}
t_0 := \frac{x \cdot \frac{x}{y}}{y \cdot 2} + -1\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -2.3 \cdot 10^{+94}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.72 \cdot 10^{-25}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+52}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 4 Error 16.8 Cost 592
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+121}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{+57}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{-27}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{+32}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\]
Alternative 5 Error 31.9 Cost 64
\[-1
\]