
(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 11 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}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* a b) (+ (* z t) (* x y))))) (if (<= t_1 INFINITY) t_1 (* x (+ (+ y (* a (/ b x))) (* t (/ z x)))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + ((z * t) + (x * y));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = x * ((y + (a * (b / x))) + (t * (z / x)));
}
return tmp;
}
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + ((z * t) + (x * y));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = x * ((y + (a * (b / x))) + (t * (z / x)));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = (a * b) + ((z * t) + (x * y)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = x * ((y + (a * (b / x))) + (t * (z / x))) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(x * Float64(Float64(y + Float64(a * Float64(b / x))) + Float64(t * Float64(z / x)))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (a * b) + ((z * t) + (x * y));
tmp = 0.0;
if (t_1 <= Inf)
tmp = t_1;
else
tmp = x * ((y + (a * (b / x))) + (t * (z / x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(x * N[(N[(y + N[(a * N[(b / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := a \cdot b + \left(z \cdot t + x \cdot y\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(y + a \cdot \frac{b}{x}\right) + t \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
fma-define20.0%
Simplified20.0%
Taylor expanded in x around inf 20.0%
associate-+r+20.0%
associate-/l*60.0%
associate-/l*80.0%
Simplified80.0%
Final simplification99.6%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (fma x y (fma a b (* z t))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(a, b, (z * t)));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(x, y, fma(a, b, Float64(z * t))) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\right)\right)
\end{array}
Initial program 98.0%
associate-+l+98.0%
fma-define98.4%
+-commutative98.4%
fma-define98.8%
Simplified98.8%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (fma x y (* z t)) (* a b)))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, (z * t)) + (a * b);
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(fma(x, y, Float64(z * t)) + Float64(a * b)) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b
\end{array}
Initial program 98.0%
fma-define98.4%
Simplified98.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* a b) (+ (* z t) (* x y))))) (if (<= t_1 INFINITY) t_1 (* x (+ y (/ (* z t) x))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + ((z * t) + (x * y));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = x * (y + ((z * t) / x));
}
return tmp;
}
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + ((z * t) + (x * y));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = x * (y + ((z * t) / x));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = (a * b) + ((z * t) + (x * y)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = x * (y + ((z * t) / x)) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(x * Float64(y + Float64(Float64(z * t) / x))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (a * b) + ((z * t) + (x * y));
tmp = 0.0;
if (t_1 <= Inf)
tmp = t_1;
else
tmp = x * (y + ((z * t) / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(x * N[(y + N[(N[(z * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := a \cdot b + \left(z \cdot t + x \cdot y\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + \frac{z \cdot t}{x}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
fma-define20.0%
Simplified20.0%
Taylor expanded in x around inf 20.0%
associate-+r+20.0%
associate-/l*60.0%
associate-/l*80.0%
Simplified80.0%
clear-num80.0%
inv-pow80.0%
Applied egg-rr80.0%
unpow-180.0%
Simplified80.0%
Taylor expanded in a around 0 80.0%
Final simplification99.6%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -1e-7)
(* a b)
(if (<= (* a b) 8e-101)
(* z t)
(if (<= (* a b) 1.95e+33) (* x y) (* a b)))))assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -1e-7) {
tmp = a * b;
} else if ((a * b) <= 8e-101) {
tmp = z * t;
} else if ((a * b) <= 1.95e+33) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this 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
real(8) :: tmp
if ((a * b) <= (-1d-7)) then
tmp = a * b
else if ((a * b) <= 8d-101) then
tmp = z * t
else if ((a * b) <= 1.95d+33) then
tmp = x * y
else
tmp = a * b
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -1e-7) {
tmp = a * b;
} else if ((a * b) <= 8e-101) {
tmp = z * t;
} else if ((a * b) <= 1.95e+33) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -1e-7: tmp = a * b elif (a * b) <= 8e-101: tmp = z * t elif (a * b) <= 1.95e+33: tmp = x * y else: tmp = a * b return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -1e-7) tmp = Float64(a * b); elseif (Float64(a * b) <= 8e-101) tmp = Float64(z * t); elseif (Float64(a * b) <= 1.95e+33) tmp = Float64(x * y); else tmp = Float64(a * b); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a * b) <= -1e-7)
tmp = a * b;
elseif ((a * b) <= 8e-101)
tmp = z * t;
elseif ((a * b) <= 1.95e+33)
tmp = x * y;
else
tmp = a * b;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e-7], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8e-101], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.95e+33], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{-7}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 8 \cdot 10^{-101}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.95 \cdot 10^{+33}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -9.9999999999999995e-8 or 1.9500000000000001e33 < (*.f64 a b) Initial program 97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in a around inf 64.3%
if -9.9999999999999995e-8 < (*.f64 a b) < 8.00000000000000041e-101Initial program 99.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 64.7%
Taylor expanded in z around inf 64.7%
associate-/l*62.7%
Simplified62.7%
Taylor expanded in t around inf 58.5%
if 8.00000000000000041e-101 < (*.f64 a b) < 1.9500000000000001e33Initial program 95.8%
Taylor expanded in x around inf 94.5%
Taylor expanded in y around inf 94.5%
associate-/l*90.4%
Simplified90.4%
Taylor expanded in x around inf 70.9%
Final simplification62.7%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -4e+111) (+ (* z t) (* x y)) (if (<= (* x y) 1e+44) (+ (* z t) (* a b)) (* y (+ x (* a (/ b y)))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -4e+111) {
tmp = (z * t) + (x * y);
} else if ((x * y) <= 1e+44) {
tmp = (z * t) + (a * b);
} else {
tmp = y * (x + (a * (b / y)));
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this 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
real(8) :: tmp
if ((x * y) <= (-4d+111)) then
tmp = (z * t) + (x * y)
else if ((x * y) <= 1d+44) then
tmp = (z * t) + (a * b)
else
tmp = y * (x + (a * (b / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -4e+111) {
tmp = (z * t) + (x * y);
} else if ((x * y) <= 1e+44) {
tmp = (z * t) + (a * b);
} else {
tmp = y * (x + (a * (b / y)));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -4e+111: tmp = (z * t) + (x * y) elif (x * y) <= 1e+44: tmp = (z * t) + (a * b) else: tmp = y * (x + (a * (b / y))) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -4e+111) tmp = Float64(Float64(z * t) + Float64(x * y)); elseif (Float64(x * y) <= 1e+44) tmp = Float64(Float64(z * t) + Float64(a * b)); else tmp = Float64(y * Float64(x + Float64(a * Float64(b / y)))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((x * y) <= -4e+111)
tmp = (z * t) + (x * y);
elseif ((x * y) <= 1e+44)
tmp = (z * t) + (a * b);
else
tmp = y * (x + (a * (b / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+111], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+44], N[(N[(z * t), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + N[(a * N[(b / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+111}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 10^{+44}:\\
\;\;\;\;z \cdot t + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + a \cdot \frac{b}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999983e111Initial program 97.4%
fma-define97.4%
Simplified97.4%
Taylor expanded in x around inf 97.4%
associate-+r+97.4%
associate-/l*97.3%
associate-/l*97.3%
Simplified97.3%
clear-num97.3%
inv-pow97.3%
Applied egg-rr97.3%
unpow-197.3%
Simplified97.3%
Taylor expanded in a around 0 95.1%
Taylor expanded in x around 0 95.1%
if -3.99999999999999983e111 < (*.f64 x y) < 1.0000000000000001e44Initial program 99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in x around 0 93.5%
if 1.0000000000000001e44 < (*.f64 x y) Initial program 95.2%
Taylor expanded in x around inf 87.1%
Taylor expanded in y around inf 87.0%
associate-/l*88.6%
Simplified88.6%
Final simplification92.5%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -4e+111) (not (<= (* x y) 1e+24))) (+ (* z t) (* x y)) (+ (* z t) (* a b))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -4e+111) || !((x * y) <= 1e+24)) {
tmp = (z * t) + (x * y);
} else {
tmp = (z * t) + (a * b);
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this 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
real(8) :: tmp
if (((x * y) <= (-4d+111)) .or. (.not. ((x * y) <= 1d+24))) then
tmp = (z * t) + (x * y)
else
tmp = (z * t) + (a * b)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -4e+111) || !((x * y) <= 1e+24)) {
tmp = (z * t) + (x * y);
} else {
tmp = (z * t) + (a * b);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -4e+111) or not ((x * y) <= 1e+24): tmp = (z * t) + (x * y) else: tmp = (z * t) + (a * b) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(x * y) <= -4e+111) || !(Float64(x * y) <= 1e+24)) tmp = Float64(Float64(z * t) + Float64(x * y)); else tmp = Float64(Float64(z * t) + Float64(a * b)); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (((x * y) <= -4e+111) || ~(((x * y) <= 1e+24)))
tmp = (z * t) + (x * y);
else
tmp = (z * t) + (a * b);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -4e+111], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+24]], $MachinePrecision]], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+111} \lor \neg \left(x \cdot y \leq 10^{+24}\right):\\
\;\;\;\;z \cdot t + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + a \cdot b\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999983e111 or 9.9999999999999998e23 < (*.f64 x y) Initial program 95.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in x around inf 94.4%
associate-+r+94.4%
associate-/l*94.4%
associate-/l*94.5%
Simplified94.5%
clear-num94.4%
inv-pow94.4%
Applied egg-rr94.4%
unpow-194.4%
Simplified94.4%
Taylor expanded in a around 0 82.8%
Taylor expanded in x around 0 82.7%
if -3.99999999999999983e111 < (*.f64 x y) < 9.9999999999999998e23Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 94.0%
Final simplification89.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -4e+111) (+ (* z t) (* x y)) (if (<= (* x y) 4e+42) (+ (* z t) (* a b)) (+ (* a b) (* x y)))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -4e+111) {
tmp = (z * t) + (x * y);
} else if ((x * y) <= 4e+42) {
tmp = (z * t) + (a * b);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this 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
real(8) :: tmp
if ((x * y) <= (-4d+111)) then
tmp = (z * t) + (x * y)
else if ((x * y) <= 4d+42) then
tmp = (z * t) + (a * b)
else
tmp = (a * b) + (x * y)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -4e+111) {
tmp = (z * t) + (x * y);
} else if ((x * y) <= 4e+42) {
tmp = (z * t) + (a * b);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -4e+111: tmp = (z * t) + (x * y) elif (x * y) <= 4e+42: tmp = (z * t) + (a * b) else: tmp = (a * b) + (x * y) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -4e+111) tmp = Float64(Float64(z * t) + Float64(x * y)); elseif (Float64(x * y) <= 4e+42) tmp = Float64(Float64(z * t) + Float64(a * b)); else tmp = Float64(Float64(a * b) + Float64(x * y)); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((x * y) <= -4e+111)
tmp = (z * t) + (x * y);
elseif ((x * y) <= 4e+42)
tmp = (z * t) + (a * b);
else
tmp = (a * b) + (x * y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+111], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+42], N[(N[(z * t), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+111}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+42}:\\
\;\;\;\;z \cdot t + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999983e111Initial program 97.4%
fma-define97.4%
Simplified97.4%
Taylor expanded in x around inf 97.4%
associate-+r+97.4%
associate-/l*97.3%
associate-/l*97.3%
Simplified97.3%
clear-num97.3%
inv-pow97.3%
Applied egg-rr97.3%
unpow-197.3%
Simplified97.3%
Taylor expanded in a around 0 95.1%
Taylor expanded in x around 0 95.1%
if -3.99999999999999983e111 < (*.f64 x y) < 4.00000000000000018e42Initial program 99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in x around 0 93.5%
if 4.00000000000000018e42 < (*.f64 x y) Initial program 95.2%
Taylor expanded in x around inf 87.3%
Final simplification92.2%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= y -6.2e-12) (not (<= y 8.2e+177))) (* x y) (+ (* z t) (* a b))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -6.2e-12) || !(y <= 8.2e+177)) {
tmp = x * y;
} else {
tmp = (z * t) + (a * b);
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this 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
real(8) :: tmp
if ((y <= (-6.2d-12)) .or. (.not. (y <= 8.2d+177))) then
tmp = x * y
else
tmp = (z * t) + (a * b)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -6.2e-12) || !(y <= 8.2e+177)) {
tmp = x * y;
} else {
tmp = (z * t) + (a * b);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (y <= -6.2e-12) or not (y <= 8.2e+177): tmp = x * y else: tmp = (z * t) + (a * b) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -6.2e-12) || !(y <= 8.2e+177)) tmp = Float64(x * y); else tmp = Float64(Float64(z * t) + Float64(a * b)); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((y <= -6.2e-12) || ~((y <= 8.2e+177)))
tmp = x * y;
else
tmp = (z * t) + (a * b);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -6.2e-12], N[Not[LessEqual[y, 8.2e+177]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-12} \lor \neg \left(y \leq 8.2 \cdot 10^{+177}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + a \cdot b\\
\end{array}
\end{array}
if y < -6.2000000000000002e-12 or 8.20000000000000029e177 < y Initial program 95.0%
Taylor expanded in x around inf 77.7%
Taylor expanded in y around inf 77.7%
associate-/l*79.6%
Simplified79.6%
Taylor expanded in x around inf 56.2%
if -6.2000000000000002e-12 < y < 8.20000000000000029e177Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 85.5%
Final simplification73.9%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -9.5e+142) (not (<= (* a b) 2e+34))) (* a b) (* x y)))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -9.5e+142) || !((a * b) <= 2e+34)) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this 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
real(8) :: tmp
if (((a * b) <= (-9.5d+142)) .or. (.not. ((a * b) <= 2d+34))) then
tmp = a * b
else
tmp = x * y
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -9.5e+142) || !((a * b) <= 2e+34)) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -9.5e+142) or not ((a * b) <= 2e+34): tmp = a * b else: tmp = x * y return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -9.5e+142) || !(Float64(a * b) <= 2e+34)) tmp = Float64(a * b); else tmp = Float64(x * y); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (((a * b) <= -9.5e+142) || ~(((a * b) <= 2e+34)))
tmp = a * b;
else
tmp = x * y;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -9.5e+142], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+34]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(x * y), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -9.5 \cdot 10^{+142} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+34}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -9.50000000000000001e142 or 1.99999999999999989e34 < (*.f64 a b) Initial program 97.2%
fma-define97.2%
Simplified97.2%
Taylor expanded in a around inf 70.6%
if -9.50000000000000001e142 < (*.f64 a b) < 1.99999999999999989e34Initial program 98.6%
Taylor expanded in x around inf 59.6%
Taylor expanded in y around inf 58.9%
associate-/l*57.0%
Simplified57.0%
Taylor expanded in x around inf 45.6%
Final simplification56.0%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (* a b))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this 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 = a * b
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return a * b
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(a * b) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = a * b;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
a \cdot b
\end{array}
Initial program 98.0%
fma-define98.4%
Simplified98.4%
Taylor expanded in a around inf 39.5%
herbie shell --seed 2024180
(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)))