\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\]
Simplified0.02
\[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\right)}
\]
Proof
[Start]0.04
\[ \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\]
associate-+l+ [=>]0.04
\[ \color{blue}{\left(x \cdot y + z \cdot t\right) + \left(a \cdot b + c \cdot i\right)}
\]
associate-+l+ [=>]0.04
\[ \color{blue}{x \cdot y + \left(z \cdot t + \left(a \cdot b + c \cdot i\right)\right)}
\]
fma-def [=>]0.03
\[ \color{blue}{\mathsf{fma}\left(x, y, z \cdot t + \left(a \cdot b + c \cdot i\right)\right)}
\]
associate-+r+ [=>]0.03
\[ \mathsf{fma}\left(x, y, \color{blue}{\left(z \cdot t + a \cdot b\right) + c \cdot i}\right)
\]
+-commutative [=>]0.03
\[ \mathsf{fma}\left(x, y, \color{blue}{c \cdot i + \left(z \cdot t + a \cdot b\right)}\right)
\]
fma-def [=>]0.02
\[ \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(c, i, z \cdot t + a \cdot b\right)}\right)
\]
+-commutative [=>]0.02
\[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, \color{blue}{a \cdot b + z \cdot t}\right)\right)
\]
fma-def [=>]0.02
\[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, \color{blue}{\mathsf{fma}\left(a, b, z \cdot t\right)}\right)\right)
\]
Final simplification0.02
\[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\right)
\]
Alternatives
Alternative 1
Error
0.02%
Cost
19776
\[\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
\]
Alternative 2
Error
35.81%
Cost
3048
\[\begin{array}{l}
t_1 := c \cdot i + x \cdot y\\
t_2 := a \cdot b + x \cdot y\\
t_3 := c \cdot i + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -1.72 \cdot 10^{+72}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq -1.5 \cdot 10^{+33}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq -1.85 \cdot 10^{-6}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq -1.5 \cdot 10^{-16}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \cdot b \leq 6.4 \cdot 10^{-300}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 5.2 \cdot 10^{-235}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \cdot b \leq 3.15 \cdot 10^{-195}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.75 \cdot 10^{-118}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \cdot b \leq 4.7 \cdot 10^{-28}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 40:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\]
Alternative 3
Error
36.69%
Cost
2788
\[\begin{array}{l}
t_1 := a \cdot b + 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 -2.5 \cdot 10^{+152}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -1.5 \cdot 10^{+16}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq -6 \cdot 10^{-30}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq -1.9 \cdot 10^{-162}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 0:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 2.3 \cdot 10^{-186}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 1.08 \cdot 10^{-44}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 1.12 \cdot 10^{+60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 1.55 \cdot 10^{+103}:\\
\;\;\;\;c \cdot i + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
\[\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\mathbf{if}\;z \leq -1.64 \cdot 10^{+198}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{+158}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{+129} \lor \neg \left(z \leq 2.4 \cdot 10^{-190}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\
\end{array}
\]
Alternative 12
Error
9.33%
Cost
1225
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5.5 \cdot 10^{+75} \lor \neg \left(a \cdot b \leq 1950000000000\right):\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(x \cdot y + z \cdot t\right)\\
\end{array}
\]
Alternative 13
Error
0.04%
Cost
960
\[\left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) + c \cdot i
\]
herbie shell --seed 2023089
(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)))