Math FPCore C Julia Wolfram TeX \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\]
↓
\[\begin{array}{l}
\mathbf{if}\;a \leq -2000 \lor \neg \left(a \leq 5 \cdot 10^{-83}\right):\\
\;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), \mathsf{fma}\left(t, a, x\right)\right)\\
\end{array}
\]
(FPCore (x y z t a b)
:precision binary64
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b))) ↓
(FPCore (x y z t a b)
:precision binary64
(if (or (<= a -2000.0) (not (<= a 5e-83)))
(fma a (+ t (* z b)) (fma y z x))
(fma z (fma a b y) (fma t a x)))) double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
↓
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2000.0) || !(a <= 5e-83)) {
tmp = fma(a, (t + (z * b)), fma(y, z, x));
} else {
tmp = fma(z, fma(a, b, y), fma(t, a, x));
}
return tmp;
}
function code(x, y, z, t, a, b)
return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b))
end
↓
function code(x, y, z, t, a, b)
tmp = 0.0
if ((a <= -2000.0) || !(a <= 5e-83))
tmp = fma(a, Float64(t + Float64(z * b)), fma(y, z, x));
else
tmp = fma(z, fma(a, b, y), fma(t, a, x));
end
return tmp
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -2000.0], N[Not[LessEqual[a, 5e-83]], $MachinePrecision]], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(y * z + x), $MachinePrecision]), $MachinePrecision], N[(z * N[(a * b + y), $MachinePrecision] + N[(t * a + x), $MachinePrecision]), $MachinePrecision]]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
↓
\begin{array}{l}
\mathbf{if}\;a \leq -2000 \lor \neg \left(a \leq 5 \cdot 10^{-83}\right):\\
\;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), \mathsf{fma}\left(t, a, x\right)\right)\\
\end{array}
Alternatives Alternative 1 Error 0.5 Cost 13640
\[\begin{array}{l}
t_1 := x + z \cdot y\\
\mathbf{if}\;a \leq -2 \cdot 10^{+109}:\\
\;\;\;\;t_1 + \left(a \cdot \left(z \cdot b\right) + a \cdot t\right)\\
\mathbf{elif}\;a \leq 10^{-86}:\\
\;\;\;\;\left(t_1 + a \cdot t\right) + b \cdot \left(a \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\
\end{array}
\]
Alternative 2 Error 0.5 Cost 7496
\[\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
t_2 := x + z \cdot y\\
\mathbf{if}\;a \leq -1 \cdot 10^{+109}:\\
\;\;\;\;t_2 + \left(t_1 + a \cdot t\right)\\
\mathbf{elif}\;a \leq 10^{-90}:\\
\;\;\;\;\left(t_2 + a \cdot t\right) + b \cdot \left(a \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \mathsf{fma}\left(t, a, t_1\right)\\
\end{array}
\]
Alternative 3 Error 10.3 Cost 1236
\[\begin{array}{l}
t_1 := x + z \cdot y\\
t_2 := t_1 + a \cdot \left(z \cdot b\right)\\
t_3 := x + a \cdot \left(t + z \cdot b\right)\\
t_4 := t_1 + a \cdot t\\
\mathbf{if}\;a \leq -5.5 \cdot 10^{+60}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \leq -1.06 \cdot 10^{-72}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq 4.3 \cdot 10^{-215}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;a \leq 2.55 \cdot 10^{-170}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq 1.6 \cdot 10^{-102}:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 4 Error 0.5 Cost 1225
\[\begin{array}{l}
t_1 := x + z \cdot y\\
\mathbf{if}\;a \leq -2 \cdot 10^{+110} \lor \neg \left(a \leq 2 \cdot 10^{-82}\right):\\
\;\;\;\;t_1 + \left(a \cdot \left(z \cdot b\right) + a \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 + a \cdot t\right) + b \cdot \left(a \cdot z\right)\\
\end{array}
\]
Alternative 5 Error 33.6 Cost 1116
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-104}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-265}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{-215}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-112}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-41}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+44}:\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 6 Error 34.2 Cost 1116
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-105}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-258}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-224}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-113}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-41}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+44}:\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 7 Error 34.2 Cost 1116
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-104}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{-261}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-215}:\\
\;\;\;\;b \cdot \left(a \cdot z\right)\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-111}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-41}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+45}:\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 8 Error 10.5 Cost 1104
\[\begin{array}{l}
t_1 := \left(x + z \cdot y\right) + a \cdot t\\
t_2 := x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{if}\;a \leq -1.4 \cdot 10^{+57}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq -6000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -2.6 \cdot 10^{-56}:\\
\;\;\;\;x + a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;a \leq 1.6 \cdot 10^{-102}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 9 Error 38.2 Cost 984
\[\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{+104}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{-102}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{-73}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 2.6 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 85000000000:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{+170}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\]
Alternative 10 Error 20.6 Cost 977
\[\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{+58}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{-147}:\\
\;\;\;\;x + z \cdot y\\
\mathbf{elif}\;a \leq 9 \cdot 10^{+90} \lor \neg \left(a \leq 9 \cdot 10^{+190}\right):\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(z \cdot b\right)\\
\end{array}
\]
Alternative 11 Error 2.9 Cost 960
\[\left(x + z \cdot y\right) + \left(a \cdot \left(z \cdot b\right) + a \cdot t\right)
\]
Alternative 12 Error 33.2 Cost 852
\[\begin{array}{l}
\mathbf{if}\;x \leq -5.3 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -8.6 \cdot 10^{-105}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-113}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-41}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+43}:\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 13 Error 26.4 Cost 849
\[\begin{array}{l}
t_1 := x + a \cdot t\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-63}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-271} \lor \neg \left(x \leq 1.9 \cdot 10^{-215}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot z\right)\\
\end{array}
\]
Alternative 14 Error 12.5 Cost 841
\[\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{-58} \lor \neg \left(a \leq 7.2 \cdot 10^{-149}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot y\\
\end{array}
\]
Alternative 15 Error 20.5 Cost 585
\[\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{+54} \lor \neg \left(a \leq 2.3 \cdot 10^{-148}\right):\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot y\\
\end{array}
\]
Alternative 16 Error 20.4 Cost 584
\[\begin{array}{l}
\mathbf{if}\;a \leq -3.9 \cdot 10^{+56}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{elif}\;a \leq 8 \cdot 10^{-149}:\\
\;\;\;\;x + z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot t\\
\end{array}
\]
Alternative 17 Error 39.4 Cost 64
\[x
\]