Average Error: 0.0 → 0.0
Time: 21.8s
Precision: binary64
Cost: 19776
\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
\[\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, \mathsf{fma}\left(b, a, c \cdot i\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 x y (fma z t (fma b a (* c i)))))
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(x, y, fma(z, t, fma(b, a, (c * i))));
}
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(x, y, fma(z, t, fma(b, a, Float64(c * i))))
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[(x * y + N[(z * t + N[(b * a + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, \mathsf{fma}\left(b, a, c \cdot i\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. Applied egg-rr0.0

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

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

Alternatives

Alternative 1
Error0.0
Cost19776
\[\mathsf{fma}\left(c, i, \mathsf{fma}\left(b, a, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right) \]
Alternative 2
Error18.5
Cost2784
\[\begin{array}{l} t_1 := a \cdot b + y \cdot x\\ t_2 := \left(a \cdot b + t \cdot z\right) + c \cdot i\\ \mathbf{if}\;c \cdot i \leq -9.2 \cdot 10^{+41}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq -5.6 \cdot 10^{-23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -2.85 \cdot 10^{-295}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-313}:\\ \;\;\;\;y \cdot x + t \cdot z\\ \mathbf{elif}\;c \cdot i \leq 6 \cdot 10^{-241}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 6.5 \cdot 10^{-151}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 3.8 \cdot 10^{-65}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 4.4 \cdot 10^{+51}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error22.4
Cost2528
\[\begin{array}{l} t_1 := t \cdot z + c \cdot i\\ t_2 := a \cdot b + y \cdot x\\ t_3 := a \cdot b + t \cdot z\\ \mathbf{if}\;c \cdot i \leq -1.35 \cdot 10^{+98}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -4.9 \cdot 10^{+61}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{+46}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -3.5 \cdot 10^{-24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 1.06 \cdot 10^{-276}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \cdot i \leq 1.05 \cdot 10^{-151}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 1.05 \cdot 10^{-75}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \cdot i \leq 6.6 \cdot 10^{+56}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
Alternative 4
Error38.1
Cost2272
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+114}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-29}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-123}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-266}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;z \cdot t \leq 10^{-272}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;z \cdot t \leq 10^{-151}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;z \cdot t \leq 6 \cdot 10^{-97}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+29}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]
Alternative 5
Error22.4
Cost2008
\[\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}\;c \cdot i \leq -8.8 \cdot 10^{+45}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \cdot i \leq -2.5 \cdot 10^{-23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 3 \cdot 10^{-277}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 5.4 \cdot 10^{-151}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 1.4 \cdot 10^{-74}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 5.4 \cdot 10^{+60}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 6
Error22.9
Cost2008
\[\begin{array}{l} t_1 := a \cdot b + c \cdot i\\ t_2 := y \cdot x + c \cdot i\\ t_3 := a \cdot b + t \cdot z\\ \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+128}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \cdot t \leq -10000000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \cdot t \leq -4 \cdot 10^{-255}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot t \leq 0:\\ \;\;\;\;a \cdot b + y \cdot x\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-106}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+29}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 7
Error38.5
Cost1752
\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -3.8 \cdot 10^{+31}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-305}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 3.6 \cdot 10^{-278}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;c \cdot i \leq 1.5 \cdot 10^{-115}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 2.6 \cdot 10^{-93}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;c \cdot i \leq 7 \cdot 10^{+112}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
Alternative 8
Error6.7
Cost1224
\[\begin{array}{l} t_1 := \left(a \cdot b + t \cdot z\right) + c \cdot i\\ \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+29}:\\ \;\;\;\;\left(a \cdot b + y \cdot x\right) + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error26.0
Cost968
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+114}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+22}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]
Alternative 10
Error23.3
Cost968
\[\begin{array}{l} t_1 := a \cdot b + t \cdot z\\ \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+114}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{-26}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error0.0
Cost960
\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
Alternative 12
Error38.5
Cost712
\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -4.2 \cdot 10^{+28}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 7 \cdot 10^{+112}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
Alternative 13
Error47.5
Cost192
\[a \cdot b \]

Error

Reproduce

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