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 := \mathsf{fma}\left(-8, \frac{y}{x} \cdot \frac{y}{x}, 1\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+41}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{-107}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+116}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, \left(y \cdot y\right) \cdot -4\right)}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;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 (fma -8.0 (* (/ y x) (/ y x)) 1.0)))
(if (<= x -1.8e+41)
t_0
(if (<= x 7.8e-107)
(fma 0.5 (* (/ x y) (/ x y)) (- 1.0))
(if (<= x 5.5e+116)
(/ (fma x x (* (* y y) -4.0)) (fma x x (* (* y 4.0) y)))
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 = fma(-8.0, ((y / x) * (y / x)), 1.0);
double tmp;
if (x <= -1.8e+41) {
tmp = t_0;
} else if (x <= 7.8e-107) {
tmp = fma(0.5, ((x / y) * (x / y)), -1.0);
} else if (x <= 5.5e+116) {
tmp = fma(x, x, ((y * y) * -4.0)) / fma(x, x, ((y * 4.0) * y));
} else {
tmp = 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 = fma(-8.0, Float64(Float64(y / x) * Float64(y / x)), 1.0)
tmp = 0.0
if (x <= -1.8e+41)
tmp = t_0;
elseif (x <= 7.8e-107)
tmp = fma(0.5, Float64(Float64(x / y) * Float64(x / y)), Float64(-1.0));
elseif (x <= 5.5e+116)
tmp = Float64(fma(x, x, Float64(Float64(y * y) * -4.0)) / fma(x, x, Float64(Float64(y * 4.0) * y)));
else
tmp = 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[(-8.0 * N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -1.8e+41], t$95$0, If[LessEqual[x, 7.8e-107], N[(0.5 * N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + (-1.0)), $MachinePrecision], If[LessEqual[x, 5.5e+116], N[(N[(x * x + N[(N[(y * y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] / N[(x * x + N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\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{fma}\left(-8, \frac{y}{x} \cdot \frac{y}{x}, 1\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+41}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{-107}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+116}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, \left(y \cdot y\right) \cdot -4\right)}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
Alternatives Alternative 1 Error 12.2 Cost 7496
\[\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-260}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+224}:\\
\;\;\;\;\frac{x \cdot x - t_0}{x \cdot x + t_0}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-8, \frac{y}{x} \cdot \frac{y}{x}, 1\right)\\
\end{array}
\]
Alternative 2 Error 14.0 Cost 7372
\[\begin{array}{l}
t_0 := \mathsf{fma}\left(-8, \frac{y}{x} \cdot \frac{y}{x}, 1\right)\\
t_1 := \left(y \cdot 4\right) \cdot y\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-109}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+120}:\\
\;\;\;\;\frac{x \cdot x - t_1}{x \cdot x + t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 3 Error 12.4 Cost 1736
\[\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-260}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+224}:\\
\;\;\;\;\frac{x \cdot x - t_0}{x \cdot x + t_0}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
Alternative 4 Error 16.9 Cost 328
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+39}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.1 \cdot 10^{-89}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
Alternative 5 Error 31.9 Cost 64
\[-1
\]