Average Error: 0.0 → 0.0
Time: 5.1s
Precision: binary64
Cost: 704
\[\left(x \cdot y + z \cdot t\right) + a \cdot b \]
\[z \cdot t + \left(a \cdot b + x \cdot y\right) \]
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
(FPCore (x y z t a b) :precision binary64 (+ (* z t) (+ (* a b) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * y) + (z * t)) + (a * b);
}
double code(double x, double y, double z, double t, double a, double b) {
	return (z * t) + ((a * b) + (x * y));
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((x * y) + (z * t)) + (a * b)
end function
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (z * t) + ((a * b) + (x * y))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x * y) + (z * t)) + (a * b);
}
public static double code(double x, double y, double z, double t, double a, double b) {
	return (z * t) + ((a * b) + (x * y));
}
def code(x, y, z, t, a, b):
	return ((x * y) + (z * t)) + (a * b)
def code(x, y, z, t, a, b):
	return (z * t) + ((a * b) + (x * y))
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b))
end
function code(x, y, z, t, a, b)
	return Float64(Float64(z * t) + Float64(Float64(a * b) + Float64(x * y)))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x * y) + (z * t)) + (a * b);
end
function tmp = code(x, y, z, t, a, b)
	tmp = (z * t) + ((a * b) + (x * y));
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := N[(N[(z * t), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
z \cdot t + \left(a \cdot b + x \cdot y\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\right)\right)} \]
  3. Applied egg-rr0.0

    \[\leadsto \color{blue}{\left(x \cdot y + a \cdot b\right) + z \cdot t} \]
  4. Final simplification0.0

    \[\leadsto z \cdot t + \left(a \cdot b + x \cdot y\right) \]

Alternatives

Alternative 1
Error35.6
Cost1248
\[\begin{array}{l} \mathbf{if}\;t \leq -2.5406307982697116 \cdot 10^{-67}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;t \leq 1.5167315307053757 \cdot 10^{-203}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;t \leq 1.344171999137543 \cdot 10^{-87}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;t \leq 6.354518738739417 \cdot 10^{-7}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;t \leq 145532068872.60223:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;t \leq 2.5899427923798394 \cdot 10^{+23}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;t \leq 3 \cdot 10^{+62}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{+117}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
Alternative 2
Error15.0
Cost976
\[\begin{array}{l} t_1 := a \cdot b + x \cdot y\\ t_2 := a \cdot b + z \cdot t\\ \mathbf{if}\;t \leq -3.4806615369311467 \cdot 10^{-189}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 2.453347472753344 \cdot 10^{-7}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.0219529260341908 \cdot 10^{+43}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 3 \cdot 10^{+62}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error10.5
Cost968
\[\begin{array}{l} t_1 := a \cdot b + z \cdot t\\ \mathbf{if}\;a \cdot b \leq -6.3930259599442986 \cdot 10^{+35}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 3.5865632118185803 \cdot 10^{-138}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error35.6
Cost720
\[\begin{array}{l} \mathbf{if}\;t \leq -2.5406307982697116 \cdot 10^{-67}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;t \leq 6.354518738739417 \cdot 10^{-7}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;t \leq 145532068872.60223:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{+117}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
Alternative 5
Error20.4
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+197}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]
Alternative 6
Error41.7
Cost192
\[a \cdot b \]

Error

Reproduce

herbie shell --seed 2022284 
(FPCore (x y z t a b)
  :name "Linear.V3:$cdot from linear-1.19.1.3, B"
  :precision binary64
  (+ (+ (* x y) (* z t)) (* a b)))