\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
↓
\mathsf{fma}\left(x, y, z \cdot t\right) + \mathsf{fma}\left(b, a, c \cdot i\right)
Error
Derivation
Initial program 0.0
\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\]
Simplified0.0
\[\leadsto \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right) + \left(a \cdot b + c \cdot i\right)}
\]
Proof
(+.f64 (fma.f64 x y (*.f64 z t)) (+.f64 (*.f64 a b) (*.f64 c i))): 0 points increase in error, 0 points decrease in error
(+.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x y) (*.f64 z t))) (+.f64 (*.f64 a b) (*.f64 c i))): 2 points increase in error, 0 points decrease in error
(Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i))): 0 points increase in error, 0 points decrease in error
Applied egg-rr0.0
\[\leadsto \mathsf{fma}\left(x, y, z \cdot t\right) + \color{blue}{\mathsf{fma}\left(b, a, c \cdot i\right)}
\]
Final simplification0.0
\[\leadsto \mathsf{fma}\left(x, y, z \cdot t\right) + \mathsf{fma}\left(b, a, c \cdot i\right)
\]
Alternatives
Alternative 1
Error
0.0
Cost
7232
\[\mathsf{fma}\left(x, y, z \cdot t\right) + \left(c \cdot i + b \cdot a\right)
\]
\[\begin{array}{l}
t_1 := c \cdot i + b \cdot a\\
\mathbf{if}\;b \cdot a \leq -1.6 \cdot 10^{+144}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \cdot a \leq 8.6 \cdot 10^{+48}:\\
\;\;\;\;c \cdot i + \left(z \cdot t + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 8
Error
5.8
Cost
1224
\[\begin{array}{l}
t_1 := c \cdot i + \left(b \cdot a + z \cdot t\right)\\
\mathbf{if}\;b \cdot a \leq -5 \cdot 10^{+39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \cdot a \leq 3.6 \cdot 10^{+17}:\\
\;\;\;\;c \cdot i + \left(z \cdot t + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 9
Error
0.0
Cost
960
\[c \cdot i + \left(b \cdot a + \left(z \cdot t + x \cdot y\right)\right)
\]
herbie shell --seed 2022331
(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)))