Math FPCore C Julia Wolfram TeX \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{+103}:\\
\;\;\;\;x \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y + -1, z \cdot x, x\right)\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z)))) ↓
(FPCore (x y z)
:precision binary64
(if (<= z 1.25e+103)
(* x (+ 1.0 (* z (+ y -1.0))))
(fma (+ y -1.0) (* z x) x))) double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
↓
double code(double x, double y, double z) {
double tmp;
if (z <= 1.25e+103) {
tmp = x * (1.0 + (z * (y + -1.0)));
} else {
tmp = fma((y + -1.0), (z * x), x);
}
return tmp;
}
function code(x, y, z)
return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z)))
end
↓
function code(x, y, z)
tmp = 0.0
if (z <= 1.25e+103)
tmp = Float64(x * Float64(1.0 + Float64(z * Float64(y + -1.0))));
else
tmp = fma(Float64(y + -1.0), Float64(z * x), x);
end
return tmp
end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_] := If[LessEqual[z, 1.25e+103], N[(x * N[(1.0 + N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y + -1.0), $MachinePrecision] * N[(z * x), $MachinePrecision] + x), $MachinePrecision]]
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
↓
\begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{+103}:\\
\;\;\;\;x \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y + -1, z \cdot x, x\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 97.4% Cost 6980
\[\begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{+103}:\\
\;\;\;\;x \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y + -1, z \cdot x, x\right)\\
\end{array}
\]
Alternative 2 Accuracy 65.8% Cost 1245
\[\begin{array}{l}
t_0 := z \cdot \left(-x\right)\\
t_1 := y \cdot \left(z \cdot x\right)\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+184}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -5.1 \cdot 10^{+97}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{+38}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.08 \cdot 10^{-16}:\\
\;\;\;\;x \cdot \left(z \cdot y\right)\\
\mathbf{elif}\;z \leq 2900000:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+147} \lor \neg \left(z \leq 4.5 \cdot 10^{+204}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Accuracy 87.6% Cost 713
\[\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{-16} \lor \neg \left(z \leq 2700000000000\right):\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot x\\
\end{array}
\]
Alternative 4 Accuracy 87.5% Cost 712
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{-20}:\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{elif}\;z \leq 2700000000000:\\
\;\;\;\;x - z \cdot x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y - x\right)\\
\end{array}
\]
Alternative 5 Accuracy 98.8% Cost 712
\[\begin{array}{l}
\mathbf{if}\;z \leq -0.9:\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(1 + z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y - x\right)\\
\end{array}
\]
Alternative 6 Accuracy 97.5% Cost 708
\[\begin{array}{l}
\mathbf{if}\;z \leq 10^{+81}:\\
\;\;\;\;x \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y - x\right)\\
\end{array}
\]
Alternative 7 Accuracy 65.9% Cost 652
\[\begin{array}{l}
t_0 := z \cdot \left(-x\right)\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \left(z \cdot y\right)\\
\mathbf{elif}\;z \leq 2900000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 8 Accuracy 84.0% Cost 584
\[\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+24}:\\
\;\;\;\;y \cdot \left(z \cdot x\right)\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+50}:\\
\;\;\;\;x - z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot y\right)\\
\end{array}
\]
Alternative 9 Accuracy 65.3% Cost 521
\[\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-11} \lor \neg \left(z \leq 2900000\right):\\
\;\;\;\;z \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 10 Accuracy 38.6% Cost 64
\[x
\]