
(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 98.8%
associate-+l+98.8%
fma-def98.8%
fma-def99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (fma x y (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + fma(x, y, (z * t));
}
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + fma(x, y, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)
\end{array}
Initial program 98.8%
fma-def98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -1.15e+121)
(* a b)
(if (<= (* a b) -7.2e-13)
(* z t)
(if (<= (* a b) -5.8e-184)
(* x y)
(if (<= (* a b) -4.5e-202)
(* z t)
(if (<= (* a b) 7.4e-115)
(* x y)
(if (<= (* a b) 7.2e-71)
(* z t)
(if (<= (* a b) 6.2e+61) (* x y) (* a b)))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -1.15e+121) {
tmp = a * b;
} else if ((a * b) <= -7.2e-13) {
tmp = z * t;
} else if ((a * b) <= -5.8e-184) {
tmp = x * y;
} else if ((a * b) <= -4.5e-202) {
tmp = z * t;
} else if ((a * b) <= 7.4e-115) {
tmp = x * y;
} else if ((a * b) <= 7.2e-71) {
tmp = z * t;
} else if ((a * b) <= 6.2e+61) {
tmp = x * y;
} else {
tmp = a * b;
}
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) <= (-1.15d+121)) then
tmp = a * b
else if ((a * b) <= (-7.2d-13)) then
tmp = z * t
else if ((a * b) <= (-5.8d-184)) then
tmp = x * y
else if ((a * b) <= (-4.5d-202)) then
tmp = z * t
else if ((a * b) <= 7.4d-115) then
tmp = x * y
else if ((a * b) <= 7.2d-71) then
tmp = z * t
else if ((a * b) <= 6.2d+61) then
tmp = x * y
else
tmp = a * b
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) <= -1.15e+121) {
tmp = a * b;
} else if ((a * b) <= -7.2e-13) {
tmp = z * t;
} else if ((a * b) <= -5.8e-184) {
tmp = x * y;
} else if ((a * b) <= -4.5e-202) {
tmp = z * t;
} else if ((a * b) <= 7.4e-115) {
tmp = x * y;
} else if ((a * b) <= 7.2e-71) {
tmp = z * t;
} else if ((a * b) <= 6.2e+61) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -1.15e+121: tmp = a * b elif (a * b) <= -7.2e-13: tmp = z * t elif (a * b) <= -5.8e-184: tmp = x * y elif (a * b) <= -4.5e-202: tmp = z * t elif (a * b) <= 7.4e-115: tmp = x * y elif (a * b) <= 7.2e-71: tmp = z * t elif (a * b) <= 6.2e+61: tmp = x * y else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -1.15e+121) tmp = Float64(a * b); elseif (Float64(a * b) <= -7.2e-13) tmp = Float64(z * t); elseif (Float64(a * b) <= -5.8e-184) tmp = Float64(x * y); elseif (Float64(a * b) <= -4.5e-202) tmp = Float64(z * t); elseif (Float64(a * b) <= 7.4e-115) tmp = Float64(x * y); elseif (Float64(a * b) <= 7.2e-71) tmp = Float64(z * t); elseif (Float64(a * b) <= 6.2e+61) tmp = Float64(x * y); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a * b) <= -1.15e+121) tmp = a * b; elseif ((a * b) <= -7.2e-13) tmp = z * t; elseif ((a * b) <= -5.8e-184) tmp = x * y; elseif ((a * b) <= -4.5e-202) tmp = z * t; elseif ((a * b) <= 7.4e-115) tmp = x * y; elseif ((a * b) <= 7.2e-71) tmp = z * t; elseif ((a * b) <= 6.2e+61) tmp = x * y; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.15e+121], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -7.2e-13], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -5.8e-184], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -4.5e-202], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 7.4e-115], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 7.2e-71], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 6.2e+61], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.15 \cdot 10^{+121}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -7.2 \cdot 10^{-13}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -5.8 \cdot 10^{-184}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -4.5 \cdot 10^{-202}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 7.4 \cdot 10^{-115}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 7.2 \cdot 10^{-71}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 6.2 \cdot 10^{+61}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.1499999999999999e121 or 6.1999999999999998e61 < (*.f64 a b) Initial program 96.2%
Taylor expanded in a around inf 76.3%
if -1.1499999999999999e121 < (*.f64 a b) < -7.1999999999999996e-13 or -5.80000000000000028e-184 < (*.f64 a b) < -4.50000000000000039e-202 or 7.4e-115 < (*.f64 a b) < 7.2e-71Initial program 100.0%
Taylor expanded in z around inf 65.1%
if -7.1999999999999996e-13 < (*.f64 a b) < -5.80000000000000028e-184 or -4.50000000000000039e-202 < (*.f64 a b) < 7.4e-115 or 7.2e-71 < (*.f64 a b) < 6.1999999999999998e61Initial program 100.0%
Taylor expanded in x around inf 62.9%
Final simplification67.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= x -1.8e+243)
(* x y)
(if (or (<= x -7.8e+220)
(and (not (<= x -2.35e+155))
(or (<= x -1.9e+138)
(and (not (<= x -6.4e+128)) (<= x 4.3e-49)))))
(+ (* a b) (* z t))
(* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.8e+243) {
tmp = x * y;
} else if ((x <= -7.8e+220) || (!(x <= -2.35e+155) && ((x <= -1.9e+138) || (!(x <= -6.4e+128) && (x <= 4.3e-49))))) {
tmp = (a * b) + (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 <= (-1.8d+243)) then
tmp = x * y
else if ((x <= (-7.8d+220)) .or. (.not. (x <= (-2.35d+155))) .and. (x <= (-1.9d+138)) .or. (.not. (x <= (-6.4d+128))) .and. (x <= 4.3d-49)) then
tmp = (a * b) + (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 <= -1.8e+243) {
tmp = x * y;
} else if ((x <= -7.8e+220) || (!(x <= -2.35e+155) && ((x <= -1.9e+138) || (!(x <= -6.4e+128) && (x <= 4.3e-49))))) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.8e+243: tmp = x * y elif (x <= -7.8e+220) or (not (x <= -2.35e+155) and ((x <= -1.9e+138) or (not (x <= -6.4e+128) and (x <= 4.3e-49)))): tmp = (a * b) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.8e+243) tmp = Float64(x * y); elseif ((x <= -7.8e+220) || (!(x <= -2.35e+155) && ((x <= -1.9e+138) || (!(x <= -6.4e+128) && (x <= 4.3e-49))))) tmp = Float64(Float64(a * b) + 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 <= -1.8e+243) tmp = x * y; elseif ((x <= -7.8e+220) || (~((x <= -2.35e+155)) && ((x <= -1.9e+138) || (~((x <= -6.4e+128)) && (x <= 4.3e-49))))) tmp = (a * b) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.8e+243], N[(x * y), $MachinePrecision], If[Or[LessEqual[x, -7.8e+220], And[N[Not[LessEqual[x, -2.35e+155]], $MachinePrecision], Or[LessEqual[x, -1.9e+138], And[N[Not[LessEqual[x, -6.4e+128]], $MachinePrecision], LessEqual[x, 4.3e-49]]]]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+243}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -7.8 \cdot 10^{+220} \lor \neg \left(x \leq -2.35 \cdot 10^{+155}\right) \land \left(x \leq -1.9 \cdot 10^{+138} \lor \neg \left(x \leq -6.4 \cdot 10^{+128}\right) \land x \leq 4.3 \cdot 10^{-49}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -1.7999999999999998e243 or -7.80000000000000032e220 < x < -2.35000000000000009e155 or -1.90000000000000006e138 < x < -6.39999999999999971e128 or 4.30000000000000016e-49 < x Initial program 97.3%
Taylor expanded in x around inf 61.5%
if -1.7999999999999998e243 < x < -7.80000000000000032e220 or -2.35000000000000009e155 < x < -1.90000000000000006e138 or -6.39999999999999971e128 < x < 4.30000000000000016e-49Initial program 100.0%
Taylor expanded in x around 0 76.0%
Final simplification69.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -2.65e+50) (not (<= (* a b) 3.7e+61))) (+ (* a b) (* z t)) (+ (* z t) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -2.65e+50) || !((a * b) <= 3.7e+61)) {
tmp = (a * b) + (z * t);
} else {
tmp = (z * t) + (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 (((a * b) <= (-2.65d+50)) .or. (.not. ((a * b) <= 3.7d+61))) then
tmp = (a * b) + (z * t)
else
tmp = (z * t) + (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 (((a * b) <= -2.65e+50) || !((a * b) <= 3.7e+61)) {
tmp = (a * b) + (z * t);
} else {
tmp = (z * t) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -2.65e+50) or not ((a * b) <= 3.7e+61): tmp = (a * b) + (z * t) else: tmp = (z * t) + (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -2.65e+50) || !(Float64(a * b) <= 3.7e+61)) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(Float64(z * t) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((a * b) <= -2.65e+50) || ~(((a * b) <= 3.7e+61))) tmp = (a * b) + (z * t); else tmp = (z * t) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -2.65e+50], N[Not[LessEqual[N[(a * b), $MachinePrecision], 3.7e+61]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.65 \cdot 10^{+50} \lor \neg \left(a \cdot b \leq 3.7 \cdot 10^{+61}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -2.6500000000000001e50 or 3.70000000000000003e61 < (*.f64 a b) Initial program 96.6%
Taylor expanded in x around 0 88.9%
if -2.6500000000000001e50 < (*.f64 a b) < 3.70000000000000003e61Initial program 100.0%
Taylor expanded in a around 0 95.5%
Final simplification93.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.55e+31) (not (<= z 3.4e-88))) (+ (* 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 ((z <= -1.55e+31) || !(z <= 3.4e-88)) {
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 ((z <= (-1.55d+31)) .or. (.not. (z <= 3.4d-88))) 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 ((z <= -1.55e+31) || !(z <= 3.4e-88)) {
tmp = (a * b) + (z * t);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.55e+31) or not (z <= 3.4e-88): 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 ((z <= -1.55e+31) || !(z <= 3.4e-88)) 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 ((z <= -1.55e+31) || ~((z <= 3.4e-88))) tmp = (a * b) + (z * t); else tmp = (a * b) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.55e+31], N[Not[LessEqual[z, 3.4e-88]], $MachinePrecision]], 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}\;z \leq -1.55 \cdot 10^{+31} \lor \neg \left(z \leq 3.4 \cdot 10^{-88}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\end{array}
if z < -1.5500000000000001e31 or 3.39999999999999975e-88 < z Initial program 97.8%
Taylor expanded in x around 0 74.2%
if -1.5500000000000001e31 < z < 3.39999999999999975e-88Initial program 100.0%
Taylor expanded in z around 0 92.5%
Final simplification82.9%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -1.2e+122) (* a b) (if (<= (* a b) 2.15e+67) (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -1.2e+122) {
tmp = a * b;
} else if ((a * b) <= 2.15e+67) {
tmp = z * t;
} else {
tmp = a * b;
}
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) <= (-1.2d+122)) then
tmp = a * b
else if ((a * b) <= 2.15d+67) then
tmp = z * t
else
tmp = a * b
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) <= -1.2e+122) {
tmp = a * b;
} else if ((a * b) <= 2.15e+67) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -1.2e+122: tmp = a * b elif (a * b) <= 2.15e+67: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -1.2e+122) tmp = Float64(a * b); elseif (Float64(a * b) <= 2.15e+67) tmp = Float64(z * t); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a * b) <= -1.2e+122) tmp = a * b; elseif ((a * b) <= 2.15e+67) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.2e+122], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.15e+67], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.2 \cdot 10^{+122}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 2.15 \cdot 10^{+67}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.2000000000000001e122 or 2.1500000000000001e67 < (*.f64 a b) Initial program 96.1%
Taylor expanded in a around inf 78.1%
if -1.2000000000000001e122 < (*.f64 a b) < 2.1500000000000001e67Initial program 100.0%
Taylor expanded in z around inf 42.5%
Final simplification53.3%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (+ (* z t) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((z * t) + (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 = (a * b) + ((z * t) + (x * y))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((z * t) + (x * y));
}
def code(x, y, z, t, a, b): return (a * b) + ((z * t) + (x * y))
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) end
function tmp = code(x, y, z, t, a, b) tmp = (a * b) + ((z * t) + (x * y)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \left(z \cdot t + x \cdot y\right)
\end{array}
Initial program 98.8%
Final simplification98.8%
(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 98.8%
Taylor expanded in a around inf 29.1%
Final simplification29.1%
herbie shell --seed 2023230
(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)))