?

Average Error: 0.0 → 0.0
Time: 1.3min
Precision: binary64
Cost: 19776

?

\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
\[\mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, \mathsf{fma}\left(z, t, x \cdot y\right)\right)\right) \]
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
(FPCore (x y z t a b c i)
 :precision binary64
 (fma i c (fma b a (fma z t (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return fma(i, c, fma(b, a, fma(z, t, (x * y))));
}
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i))
end
function code(x, y, z, t, a, b, c, i)
	return fma(i, c, fma(b, a, fma(z, t, Float64(x * y))))
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(i * c + N[(b * a + N[(z * t + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, \mathsf{fma}\left(z, t, x \cdot y\right)\right)\right)

Error?

Derivation?

  1. Initial program 0.0

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, \mathsf{fma}\left(z, t, x \cdot y\right)\right)\right)} \]
    Proof

Alternatives

Alternative 1
Error0.0
Cost7232
\[\left(x \cdot y + \mathsf{fma}\left(b, a, c \cdot i\right)\right) + t \cdot z \]
Alternative 2
Error31.8
Cost2164
\[\begin{array}{l} t_1 := a \cdot b + t \cdot z\\ t_2 := a \cdot b + c \cdot i\\ \mathbf{if}\;x \leq -4.9 \cdot 10^{+64}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-74}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq -5.4 \cdot 10^{-106}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-117}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq -4 \cdot 10^{-245}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.96 \cdot 10^{-299}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-205}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-159}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{+50}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+166}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{+271}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error28.2
Cost1900
\[\begin{array}{l} t_1 := a \cdot b + c \cdot i\\ t_2 := a \cdot b + t \cdot z\\ t_3 := y \cdot x + c \cdot i\\ \mathbf{if}\;x \leq -2.6 \cdot 10^{-137}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{-157}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-167}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -5.6 \cdot 10^{-193}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.35 \cdot 10^{-244}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{-302}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{-204}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-160}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-111}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{+47}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.86 \cdot 10^{+164}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + y \cdot x\\ \end{array} \]
Alternative 4
Error38.3
Cost1752
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -3.5 \cdot 10^{+98}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -7 \cdot 10^{-48}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -2.6 \cdot 10^{-113}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;a \cdot b \leq 2.3 \cdot 10^{-245}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;a \cdot b \leq 4.8 \cdot 10^{-201}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;a \cdot b \leq 2.9 \cdot 10^{+74}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 5
Error9.5
Cost1748
\[\begin{array}{l} t_1 := a \cdot b + \left(y \cdot x + t \cdot z\right)\\ t_2 := a \cdot b + c \cdot i\\ \mathbf{if}\;c \cdot i \leq -2 \cdot 10^{+19}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 10^{+97}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+133}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+161}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 10^{+217}:\\ \;\;\;\;z \cdot t + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;y \cdot x + c \cdot i\\ \end{array} \]
Alternative 6
Error28.3
Cost1504
\[\begin{array}{l} t_1 := a \cdot b + y \cdot x\\ t_2 := a \cdot b + t \cdot z\\ t_3 := a \cdot b + c \cdot i\\ \mathbf{if}\;z \leq -4.9 \cdot 10^{+119}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{-196}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-239}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-279}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq -2.7 \cdot 10^{-308}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-237}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-26}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+68}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error22.1
Cost1488
\[\begin{array}{l} t_1 := y \cdot x + c \cdot i\\ t_2 := a \cdot b + t \cdot z\\ \mathbf{if}\;a \cdot b \leq -1.65 \cdot 10^{+37}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq -2.5 \cdot 10^{-45}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 3.5 \cdot 10^{-200}:\\ \;\;\;\;y \cdot x + t \cdot z\\ \mathbf{elif}\;a \cdot b \leq 4.5 \cdot 10^{+74}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Error22.2
Cost1488
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -3.95 \cdot 10^{+37}:\\ \;\;\;\;a \cdot b + t \cdot z\\ \mathbf{elif}\;a \cdot b \leq -2.05 \cdot 10^{-44}:\\ \;\;\;\;y \cdot x + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 3.2 \cdot 10^{-243}:\\ \;\;\;\;y \cdot x + t \cdot z\\ \mathbf{elif}\;a \cdot b \leq 5.8 \cdot 10^{+56}:\\ \;\;\;\;z \cdot t + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
Alternative 9
Error33.1
Cost1380
\[\begin{array}{l} t_1 := a \cdot b + c \cdot i\\ \mathbf{if}\;z \leq -1.75 \cdot 10^{+122}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{-33}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.95 \cdot 10^{-95}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-239}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-278}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{+68}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+133}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;z \leq 1.04 \cdot 10^{+154}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]
Alternative 10
Error38.3
Cost1232
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -3.7 \cdot 10^{+98}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -7 \cdot 10^{-49}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 5.5 \cdot 10^{-197}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{+76}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 11
Error6.6
Cost1224
\[\begin{array}{l} t_1 := y \cdot x + t \cdot z\\ t_2 := a \cdot b + t_1\\ \mathbf{if}\;a \cdot b \leq -3.8 \cdot 10^{+98}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 1.15 \cdot 10^{+78}:\\ \;\;\;\;c \cdot i + t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 12
Error0.0
Cost960
\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
Alternative 13
Error38.2
Cost712
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -3.7 \cdot 10^{+98}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 2.8 \cdot 10^{+74}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 14
Error47.2
Cost192
\[a \cdot b \]

Error

Reproduce?

herbie shell --seed 2023033 
(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)))