\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\]
↓
\[\begin{array}{l}
t_0 := \frac{x + 4}{y}\\
t_1 := t_0 - \frac{x}{y} \cdot z\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+211}:\\
\;\;\;\;\left|t_0 - \frac{z}{\frac{y}{x}}\right|\\
\mathbf{elif}\;t_1 \leq 2.5 \cdot 10^{+101}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t_1\right|\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
↓
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y)) (t_1 (- t_0 (* (/ x y) z))))
(if (<= t_1 -4e+211)
(fabs (- t_0 (/ z (/ y x))))
(if (<= t_1 2.5e+101)
(fabs (fma x (/ z y) (/ (- -4.0 x) y)))
(fabs t_1)))))double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
↓
double code(double x, double y, double z) {
double t_0 = (x + 4.0) / y;
double t_1 = t_0 - ((x / y) * z);
double tmp;
if (t_1 <= -4e+211) {
tmp = fabs((t_0 - (z / (y / x))));
} else if (t_1 <= 2.5e+101) {
tmp = fabs(fma(x, (z / y), ((-4.0 - x) / y)));
} else {
tmp = fabs(t_1);
}
return tmp;
}
function code(x, y, z)
return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z)))
end
↓
function code(x, y, z)
t_0 = Float64(Float64(x + 4.0) / y)
t_1 = Float64(t_0 - Float64(Float64(x / y) * z))
tmp = 0.0
if (t_1 <= -4e+211)
tmp = abs(Float64(t_0 - Float64(z / Float64(y / x))));
elseif (t_1 <= 2.5e+101)
tmp = abs(fma(x, Float64(z / y), Float64(Float64(-4.0 - x) / y)));
else
tmp = abs(t_1);
end
return tmp
end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
↓
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+211], N[Abs[N[(t$95$0 - N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2.5e+101], N[Abs[N[(x * N[(z / y), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[t$95$1], $MachinePrecision]]]]]
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
↓
\begin{array}{l}
t_0 := \frac{x + 4}{y}\\
t_1 := t_0 - \frac{x}{y} \cdot z\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+211}:\\
\;\;\;\;\left|t_0 - \frac{z}{\frac{y}{x}}\right|\\
\mathbf{elif}\;t_1 \leq 2.5 \cdot 10^{+101}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t_1\right|\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 1.14% |
|---|
| Cost | 8776 |
|---|
\[\begin{array}{l}
t_0 := \frac{x + 4}{y}\\
t_1 := t_0 - \frac{x}{y} \cdot z\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+211}:\\
\;\;\;\;\left|t_0 - \frac{z}{\frac{y}{x}}\right|\\
\mathbf{elif}\;t_1 \leq 2.5 \cdot 10^{+101}:\\
\;\;\;\;\left|\frac{4}{y} - \left(x \cdot \frac{z}{y} - \frac{x}{y}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t_1\right|\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 1.2% |
|---|
| Cost | 8649 |
|---|
\[\begin{array}{l}
t_0 := \frac{x + 4}{y} - \frac{x}{y} \cdot z\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{+167} \lor \neg \left(t_0 \leq 10^{+54}\right):\\
\;\;\;\;\left|t_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 18.93% |
|---|
| Cost | 7250 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+179} \lor \neg \left(z \leq -1.5 \cdot 10^{+133} \lor \neg \left(z \leq -4500000000000\right) \land z \leq 5.03 \cdot 10^{+125}\right):\\
\;\;\;\;\left|\frac{x}{y} \cdot z\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 30.05% |
|---|
| Cost | 7249 |
|---|
\[\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -1.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{\left|y\right|}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+218} \lor \neg \left(x \leq 4.2 \cdot 10^{+264}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} \cdot z\right|\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 30.07% |
|---|
| Cost | 7249 |
|---|
\[\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -1.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{\left|y\right|}\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+216} \lor \neg \left(x \leq 3.7 \cdot 10^{+264}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 19.44% |
|---|
| Cost | 7249 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+180}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{-z}}\right|\\
\mathbf{elif}\;z \leq -8 \cdot 10^{+126} \lor \neg \left(z \leq -3700000000000\right) \land z \leq 5.03 \cdot 10^{+125}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} \cdot z\right|\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 1.54% |
|---|
| Cost | 7113 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \lor \neg \left(x \leq 3.6\right):\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(z + -1\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4 - x \cdot z}{y}\right|\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 3.56% |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{+111}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(z + -1\right)\right|\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 29.29% |
|---|
| Cost | 6857 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{4}{\left|y\right|}\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 50.33% |
|---|
| Cost | 6592 |
|---|
\[\frac{4}{\left|y\right|}
\]