code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
↓
\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\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(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)}
\]
Proof
(fma.f64 c i (fma.f64 a b (fma.f64 x y (*.f64 z t)))): 0 points increase in error, 0 points decrease in error
(fma.f64 c i (fma.f64 a b (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x y) (*.f64 z t))))): 0 points increase in error, 0 points decrease in error
(fma.f64 c i (Rewrite<= fma-def_binary64 (+.f64 (*.f64 a b) (+.f64 (*.f64 x y) (*.f64 z t))))): 0 points increase in error, 0 points decrease in error
(fma.f64 c i (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)))): 0 points increase in error, 0 points decrease in error
(Rewrite<= fma-def_binary64 (+.f64 (*.f64 c i) (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)))): 0 points increase in error, 0 points decrease in error
(Rewrite<= +-commutative_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
Final simplification0.0
\[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
\]
Alternatives
Alternative 1
Error
27.0
Cost
2428
\[\begin{array}{l}
t_1 := a \cdot b + c \cdot i\\
t_2 := x \cdot y + z \cdot t\\
t_3 := a \cdot b + z \cdot t\\
t_4 := a \cdot b + x \cdot y\\
t_5 := c \cdot i + z \cdot t\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+120}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{+92}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{+57}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{+30}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{+24}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{+14}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{-24}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq -6.8 \cdot 10^{-41}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{-76}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-155}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;x \leq -1.75 \cdot 10^{-211}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.86 \cdot 10^{-258}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{-298}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-290}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{-167}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + x \cdot y\\
\end{array}
\]
herbie shell --seed 2022343
(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)))