
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
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
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b): return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * t)) + (a * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z \cdot t\right) + a \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
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
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b): return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * t)) + (a * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z \cdot t\right) + a \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (fma x y (fma z t (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(z, t, (a * b)));
}
function code(x, y, z, t, a, b) return fma(x, y, fma(z, t, Float64(a * b))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)
\end{array}
Initial program 99.2%
associate-+l+99.2%
fma-def99.2%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t a b) :precision binary64 (+ (fma x y (* a b)) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, (a * b)) + (z * t);
}
function code(x, y, z, t, a, b) return Float64(fma(x, y, Float64(a * b)) + Float64(z * t)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, a \cdot b\right) + z \cdot t
\end{array}
Initial program 99.2%
associate-+l+99.2%
fma-def99.2%
fma-def100.0%
Simplified100.0%
fma-udef99.6%
fma-udef99.2%
associate-+l+99.2%
+-commutative99.2%
associate-+l+99.2%
fma-def99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -1.4e+117)
(* x y)
(if (<= (* x y) -1.8e-190)
(* z t)
(if (<= (* x y) -6e-221)
(* a b)
(if (<= (* x y) 5e-104)
(* z t)
(if (<= (* x y) 2e-82)
(* a b)
(if (<= (* x y) 3.9e+15) (* z t) (* x y))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -1.4e+117) {
tmp = x * y;
} else if ((x * y) <= -1.8e-190) {
tmp = z * t;
} else if ((x * y) <= -6e-221) {
tmp = a * b;
} else if ((x * y) <= 5e-104) {
tmp = z * t;
} else if ((x * y) <= 2e-82) {
tmp = a * b;
} else if ((x * y) <= 3.9e+15) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
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
real(8) :: tmp
if ((x * y) <= (-1.4d+117)) then
tmp = x * y
else if ((x * y) <= (-1.8d-190)) then
tmp = z * t
else if ((x * y) <= (-6d-221)) then
tmp = a * b
else if ((x * y) <= 5d-104) then
tmp = z * t
else if ((x * y) <= 2d-82) then
tmp = a * b
else if ((x * y) <= 3.9d+15) then
tmp = z * t
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -1.4e+117) {
tmp = x * y;
} else if ((x * y) <= -1.8e-190) {
tmp = z * t;
} else if ((x * y) <= -6e-221) {
tmp = a * b;
} else if ((x * y) <= 5e-104) {
tmp = z * t;
} else if ((x * y) <= 2e-82) {
tmp = a * b;
} else if ((x * y) <= 3.9e+15) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -1.4e+117: tmp = x * y elif (x * y) <= -1.8e-190: tmp = z * t elif (x * y) <= -6e-221: tmp = a * b elif (x * y) <= 5e-104: tmp = z * t elif (x * y) <= 2e-82: tmp = a * b elif (x * y) <= 3.9e+15: tmp = z * t else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -1.4e+117) tmp = Float64(x * y); elseif (Float64(x * y) <= -1.8e-190) tmp = Float64(z * t); elseif (Float64(x * y) <= -6e-221) tmp = Float64(a * b); elseif (Float64(x * y) <= 5e-104) tmp = Float64(z * t); elseif (Float64(x * y) <= 2e-82) tmp = Float64(a * b); elseif (Float64(x * y) <= 3.9e+15) tmp = Float64(z * t); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -1.4e+117) tmp = x * y; elseif ((x * y) <= -1.8e-190) tmp = z * t; elseif ((x * y) <= -6e-221) tmp = a * b; elseif ((x * y) <= 5e-104) tmp = z * t; elseif ((x * y) <= 2e-82) tmp = a * b; elseif ((x * y) <= 3.9e+15) tmp = z * t; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -1.4e+117], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1.8e-190], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -6e-221], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-104], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-82], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.9e+15], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.4 \cdot 10^{+117}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -1.8 \cdot 10^{-190}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq -6 \cdot 10^{-221}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-104}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-82}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 3.9 \cdot 10^{+15}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -1.39999999999999999e117 or 3.9e15 < (*.f64 x y) Initial program 99.0%
Taylor expanded in x around inf 72.0%
if -1.39999999999999999e117 < (*.f64 x y) < -1.80000000000000003e-190 or -6.0000000000000003e-221 < (*.f64 x y) < 4.99999999999999979e-104 or 2e-82 < (*.f64 x y) < 3.9e15Initial program 99.3%
Taylor expanded in z around inf 57.1%
if -1.80000000000000003e-190 < (*.f64 x y) < -6.0000000000000003e-221 or 4.99999999999999979e-104 < (*.f64 x y) < 2e-82Initial program 100.0%
Taylor expanded in a around inf 81.2%
Final simplification64.8%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= (* a b) -8.2e+151)
(not
(or (<= (* a b) 1.95e+36)
(and (not (<= (* a b) 2.5e+107)) (<= (* a b) 3.3e+132)))))
(* a b)
(* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -8.2e+151) || !(((a * b) <= 1.95e+36) || (!((a * b) <= 2.5e+107) && ((a * b) <= 3.3e+132)))) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
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
real(8) :: tmp
if (((a * b) <= (-8.2d+151)) .or. (.not. ((a * b) <= 1.95d+36) .or. (.not. ((a * b) <= 2.5d+107)) .and. ((a * b) <= 3.3d+132))) then
tmp = a * b
else
tmp = z * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -8.2e+151) || !(((a * b) <= 1.95e+36) || (!((a * b) <= 2.5e+107) && ((a * b) <= 3.3e+132)))) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -8.2e+151) or not (((a * b) <= 1.95e+36) or (not ((a * b) <= 2.5e+107) and ((a * b) <= 3.3e+132))): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -8.2e+151) || !((Float64(a * b) <= 1.95e+36) || (!(Float64(a * b) <= 2.5e+107) && (Float64(a * b) <= 3.3e+132)))) tmp = Float64(a * b); else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((a * b) <= -8.2e+151) || ~((((a * b) <= 1.95e+36) || (~(((a * b) <= 2.5e+107)) && ((a * b) <= 3.3e+132))))) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -8.2e+151], N[Not[Or[LessEqual[N[(a * b), $MachinePrecision], 1.95e+36], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.5e+107]], $MachinePrecision], LessEqual[N[(a * b), $MachinePrecision], 3.3e+132]]]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.2 \cdot 10^{+151} \lor \neg \left(a \cdot b \leq 1.95 \cdot 10^{+36} \lor \neg \left(a \cdot b \leq 2.5 \cdot 10^{+107}\right) \land a \cdot b \leq 3.3 \cdot 10^{+132}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -8.1999999999999996e151 or 1.9500000000000001e36 < (*.f64 a b) < 2.5000000000000001e107 or 3.3000000000000003e132 < (*.f64 a b) Initial program 97.3%
Taylor expanded in a around inf 76.7%
if -8.1999999999999996e151 < (*.f64 a b) < 1.9500000000000001e36 or 2.5000000000000001e107 < (*.f64 a b) < 3.3000000000000003e132Initial program 100.0%
Taylor expanded in z around inf 47.7%
Final simplification56.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -1.7e+117) (not (<= (* x y) 1.4e+132))) (* x y) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -1.7e+117) || !((x * y) <= 1.4e+132)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
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
real(8) :: tmp
if (((x * y) <= (-1.7d+117)) .or. (.not. ((x * y) <= 1.4d+132))) then
tmp = x * y
else
tmp = (a * b) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -1.7e+117) || !((x * y) <= 1.4e+132)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -1.7e+117) or not ((x * y) <= 1.4e+132): tmp = x * y else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(x * y) <= -1.7e+117) || !(Float64(x * y) <= 1.4e+132)) tmp = Float64(x * y); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((x * y) <= -1.7e+117) || ~(((x * y) <= 1.4e+132))) tmp = x * y; else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1.7e+117], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.4e+132]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.7 \cdot 10^{+117} \lor \neg \left(x \cdot y \leq 1.4 \cdot 10^{+132}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -1.7e117 or 1.4e132 < (*.f64 x y) Initial program 98.8%
Taylor expanded in x around inf 78.1%
if -1.7e117 < (*.f64 x y) < 1.4e132Initial program 99.4%
Taylor expanded in x around 0 83.3%
Final simplification81.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -7.6e+71) (not (<= (* x y) 0.118))) (+ (* a b) (* x y)) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -7.6e+71) || !((x * y) <= 0.118)) {
tmp = (a * b) + (x * y);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
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
real(8) :: tmp
if (((x * y) <= (-7.6d+71)) .or. (.not. ((x * y) <= 0.118d0))) then
tmp = (a * b) + (x * y)
else
tmp = (a * b) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -7.6e+71) || !((x * y) <= 0.118)) {
tmp = (a * b) + (x * y);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -7.6e+71) or not ((x * y) <= 0.118): tmp = (a * b) + (x * y) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(x * y) <= -7.6e+71) || !(Float64(x * y) <= 0.118)) tmp = Float64(Float64(a * b) + Float64(x * y)); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((x * y) <= -7.6e+71) || ~(((x * y) <= 0.118))) tmp = (a * b) + (x * y); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -7.6e+71], N[Not[LessEqual[N[(x * y), $MachinePrecision], 0.118]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -7.6 \cdot 10^{+71} \lor \neg \left(x \cdot y \leq 0.118\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -7.6000000000000001e71 or 0.11799999999999999 < (*.f64 x y) Initial program 98.2%
Taylor expanded in z around 0 85.1%
if -7.6000000000000001e71 < (*.f64 x y) < 0.11799999999999999Initial program 100.0%
Taylor expanded in x around 0 88.7%
Final simplification87.1%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -3.7e-95) (+ (* x y) (* z t)) (if (<= (* x y) 3.35) (+ (* a b) (* z t)) (+ (* a b) (* x y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -3.7e-95) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 3.35) {
tmp = (a * b) + (z * t);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
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
real(8) :: tmp
if ((x * y) <= (-3.7d-95)) then
tmp = (x * y) + (z * t)
else if ((x * y) <= 3.35d0) then
tmp = (a * b) + (z * t)
else
tmp = (a * b) + (x * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -3.7e-95) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 3.35) {
tmp = (a * b) + (z * t);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -3.7e-95: tmp = (x * y) + (z * t) elif (x * y) <= 3.35: tmp = (a * b) + (z * t) else: tmp = (a * b) + (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -3.7e-95) tmp = Float64(Float64(x * y) + Float64(z * t)); elseif (Float64(x * y) <= 3.35) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(Float64(a * b) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -3.7e-95) tmp = (x * y) + (z * t); elseif ((x * y) <= 3.35) tmp = (a * b) + (z * t); else tmp = (a * b) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -3.7e-95], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.35], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.7 \cdot 10^{-95}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 3.35:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -3.69999999999999994e-95Initial program 97.0%
Taylor expanded in a around 0 82.8%
if -3.69999999999999994e-95 < (*.f64 x y) < 3.35000000000000009Initial program 100.0%
Taylor expanded in x around 0 93.1%
if 3.35000000000000009 < (*.f64 x y) Initial program 99.9%
Taylor expanded in z around 0 84.2%
Final simplification88.0%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (+ (* x y) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((x * y) + (z * t));
}
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 = (a * b) + ((x * y) + (z * t))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((x * y) + (z * t));
}
def code(x, y, z, t, a, b): return (a * b) + ((x * y) + (z * t))
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) end
function tmp = code(x, y, z, t, a, b) tmp = (a * b) + ((x * y) + (z * t)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \left(x \cdot y + z \cdot t\right)
\end{array}
Initial program 99.2%
Final simplification99.2%
(FPCore (x y z t a b) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
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 = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
def code(x, y, z, t, a, b): return a * b
function code(x, y, z, t, a, b) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 99.2%
Taylor expanded in a around inf 31.1%
Final simplification31.1%
herbie shell --seed 2024010
(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)))