\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
↓
\left(\mathsf{fma}\left(z, t, x \cdot y\right) + a \cdot b\right) + c \cdot i
Error
Derivation
Initial program 0.0
\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\]
Applied egg-rr0.0
\[\leadsto \left(\color{blue}{\mathsf{fma}\left(z, t, x \cdot y\right)} + a \cdot b\right) + c \cdot i
\]
Final simplification0.0
\[\leadsto \left(\mathsf{fma}\left(z, t, x \cdot y\right) + a \cdot b\right) + c \cdot i
\]
Alternatives
Alternative 1
Error
22.5
Cost
3308
\[\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
t_2 := x \cdot y + z \cdot t\\
t_3 := a \cdot b + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -4.59897655652324 \cdot 10^{+99}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \cdot b \leq -290858446975096.4:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq -8582.153912381755:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \cdot b \leq -2.7418902451002085 \cdot 10^{-111}:\\
\;\;\;\;c \cdot i + x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 0:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 1.4500433854554794 \cdot 10^{-200}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 8.666019754023415 \cdot 10^{-66}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 5547118151904124:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 7.731835391626913 \cdot 10^{+58}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 6.717108196425891 \cdot 10^{+79}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 1.94523397463608 \cdot 10^{+110}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\]
\[\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := a \cdot b + x \cdot y\\
\mathbf{if}\;c \cdot i \leq -1.358844706598043 \cdot 10^{+98}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -3.401675787281868 \cdot 10^{-202}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-315}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 9.992171602241318 \cdot 10^{-177}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 1.805179611012147 \cdot 10^{+27}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 1.9210968025577913 \cdot 10^{+120}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 4
Error
22.3
Cost
2008
\[\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := a \cdot b + x \cdot y\\
t_3 := c \cdot i + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -9.807819972756106 \cdot 10^{+26}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq -2.7199292467088673 \cdot 10^{-11}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq -5.073986458595875 \cdot 10^{-63}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;c \cdot i \leq -3.401675787281868 \cdot 10^{-202}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 10^{-321}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 1.1710804514326169 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
\[\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := c \cdot i + x \cdot y\\
\mathbf{if}\;i \leq -5.562923229365624 \cdot 10^{-77}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 3.1485143957021743 \cdot 10^{-242}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq 3.886081380139228 \cdot 10^{-224}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 1.507809531328107 \cdot 10^{-197}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq 7.061995077612288 \cdot 10^{+38}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{elif}\;i \leq 9.6 \cdot 10^{+88}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq 7.6 \cdot 10^{+141}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 3.95 \cdot 10^{+167}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 7
Error
24.7
Cost
1488
\[\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -1.358844706598043 \cdot 10^{+98}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -1.4588827525895657 \cdot 10^{-248}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-315}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 1.9210968025577913 \cdot 10^{+120}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 8
Error
9.1
Cost
1224
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.59897655652324 \cdot 10^{+99}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.0305608485718354 \cdot 10^{+20}:\\
\;\;\;\;c \cdot i + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\]
Alternative 9
Error
6.6
Cost
1224
\[\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := a \cdot b + t_1\\
\mathbf{if}\;a \cdot b \leq -4.59897655652324 \cdot 10^{+99}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 1.0305608485718354 \cdot 10^{+20}:\\
\;\;\;\;c \cdot i + t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 10
Error
0.0
Cost
960
\[c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)
\]
herbie shell --seed 2022300
(FPCore (x y z t a b c i)
:name "Linear.V4:$cdot from linear-1.19.1.3, C"
:precision binary64
(+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))