
(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}
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 (<= (+ (+ (* z t) (* x y)) (* a b)) INFINITY) (+ (fma x y (* z t)) (* a b)) (* z (+ t (+ (* x (/ y z)) (* a (/ b z)))))))
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 ((((z * t) + (x * y)) + (a * b)) <= ((double) INFINITY)) {
tmp = fma(x, y, (z * t)) + (a * b);
} else {
tmp = z * (t + ((x * (y / z)) + (a * (b / z))));
}
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(Float64(Float64(z * t) + Float64(x * y)) + Float64(a * b)) <= Inf) tmp = Float64(fma(x, y, Float64(z * t)) + Float64(a * b)); else tmp = Float64(z * Float64(t + Float64(Float64(x * Float64(y / z)) + Float64(a * Float64(b / z))))); end return 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[(N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(z * N[(t + N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b / z), $MachinePrecision]), $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}\;\left(z \cdot t + x \cdot y\right) + a \cdot b \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t + \left(x \cdot \frac{y}{z} + a \cdot \frac{b}{z}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
fma-define100.0%
Simplified100.0%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
fma-define40.0%
Simplified40.0%
Taylor expanded in z around inf 30.0%
+-commutative30.0%
associate-/l*70.0%
associate-/l*90.0%
Simplified90.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 a b (fma x y (* 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(a, b, fma(x, y, (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(a, b, fma(x, y, 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[(a * b + N[(x * y + 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(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)
\end{array}
Initial program 96.1%
+-commutative96.1%
fma-define96.9%
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 (+ (+ (* z t) (* x y)) (* a b)))) (if (<= t_1 INFINITY) t_1 (* z (+ t (+ (* x (/ y z)) (* a (/ b z))))))))
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 = ((z * t) + (x * y)) + (a * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = z * (t + ((x * (y / z)) + (a * (b / z))));
}
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 = ((z * t) + (x * y)) + (a * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = z * (t + ((x * (y / z)) + (a * (b / z))));
}
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 = ((z * t) + (x * y)) + (a * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = z * (t + ((x * (y / z)) + (a * (b / z)))) 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(Float64(z * t) + Float64(x * y)) + Float64(a * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(z * Float64(t + Float64(Float64(x * Float64(y / z)) + Float64(a * Float64(b / z))))); 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 = ((z * t) + (x * y)) + (a * b);
tmp = 0.0;
if (t_1 <= Inf)
tmp = t_1;
else
tmp = z * (t + ((x * (y / z)) + (a * (b / z))));
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[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(t + N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b / z), $MachinePrecision]), $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 := \left(z \cdot t + x \cdot y\right) + a \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t + \left(x \cdot \frac{y}{z} + a \cdot \frac{b}{z}\right)\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-define40.0%
Simplified40.0%
Taylor expanded in z around inf 30.0%
+-commutative30.0%
associate-/l*70.0%
associate-/l*90.0%
Simplified90.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 (let* ((t_1 (+ (+ (* z t) (* x y)) (* a b)))) (if (<= t_1 INFINITY) t_1 (* z (+ t (* a (/ b z)))))))
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 = ((z * t) + (x * y)) + (a * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = z * (t + (a * (b / z)));
}
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 = ((z * t) + (x * y)) + (a * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = z * (t + (a * (b / z)));
}
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 = ((z * t) + (x * y)) + (a * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = z * (t + (a * (b / z))) 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(Float64(z * t) + Float64(x * y)) + Float64(a * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(z * Float64(t + Float64(a * Float64(b / z)))); 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 = ((z * t) + (x * y)) + (a * b);
tmp = 0.0;
if (t_1 <= Inf)
tmp = t_1;
else
tmp = z * (t + (a * (b / z)));
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[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(t + N[(a * N[(b / z), $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 := \left(z \cdot t + x \cdot y\right) + a \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t + a \cdot \frac{b}{z}\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-define40.0%
Simplified40.0%
Taylor expanded in x around 0 50.0%
Taylor expanded in z around inf 60.0%
associate-*r/70.0%
Simplified70.0%
Final simplification98.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 (if (<= (* x y) -8.2e+95) (* x y) (if (<= (* x y) -0.041) (* z t) (if (<= (* x y) 2.5e+92) (* 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) <= -8.2e+95) {
tmp = x * y;
} else if ((x * y) <= -0.041) {
tmp = z * t;
} else if ((x * y) <= 2.5e+92) {
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 ((x * y) <= (-8.2d+95)) then
tmp = x * y
else if ((x * y) <= (-0.041d0)) then
tmp = z * t
else if ((x * y) <= 2.5d+92) 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 ((x * y) <= -8.2e+95) {
tmp = x * y;
} else if ((x * y) <= -0.041) {
tmp = z * t;
} else if ((x * y) <= 2.5e+92) {
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 (x * y) <= -8.2e+95: tmp = x * y elif (x * y) <= -0.041: tmp = z * t elif (x * y) <= 2.5e+92: 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(x * y) <= -8.2e+95) tmp = Float64(x * y); elseif (Float64(x * y) <= -0.041) tmp = Float64(z * t); elseif (Float64(x * y) <= 2.5e+92) 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 ((x * y) <= -8.2e+95)
tmp = x * y;
elseif ((x * y) <= -0.041)
tmp = z * t;
elseif ((x * y) <= 2.5e+92)
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[LessEqual[N[(x * y), $MachinePrecision], -8.2e+95], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -0.041], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.5e+92], 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}\;x \cdot y \leq -8.2 \cdot 10^{+95}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -0.041:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 2.5 \cdot 10^{+92}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -8.19999999999999972e95 or 2.50000000000000011e92 < (*.f64 x y) Initial program 90.4%
Taylor expanded in x around inf 87.5%
Taylor expanded in b around inf 74.5%
Taylor expanded in b around 0 75.4%
if -8.19999999999999972e95 < (*.f64 x y) < -0.0410000000000000017Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 82.3%
Taylor expanded in z around inf 75.9%
associate-*r/75.9%
Simplified75.9%
Taylor expanded in t around inf 61.4%
if -0.0410000000000000017 < (*.f64 x y) < 2.50000000000000011e92Initial program 99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in a around inf 50.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 (if (or (<= (* x y) -1.3e+96) (not (<= (* x y) 400000000000.0))) (+ (* x y) (* a b)) (+ (* 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) <= -1.3e+96) || !((x * y) <= 400000000000.0)) {
tmp = (x * y) + (a * b);
} 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) <= (-1.3d+96)) .or. (.not. ((x * y) <= 400000000000.0d0))) then
tmp = (x * y) + (a * b)
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) <= -1.3e+96) || !((x * y) <= 400000000000.0)) {
tmp = (x * y) + (a * b);
} 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) <= -1.3e+96) or not ((x * y) <= 400000000000.0): tmp = (x * y) + (a * b) 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) <= -1.3e+96) || !(Float64(x * y) <= 400000000000.0)) tmp = Float64(Float64(x * y) + Float64(a * b)); 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) <= -1.3e+96) || ~(((x * y) <= 400000000000.0)))
tmp = (x * y) + (a * b);
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], -1.3e+96], N[Not[LessEqual[N[(x * y), $MachinePrecision], 400000000000.0]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(a * b), $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 -1.3 \cdot 10^{+96} \lor \neg \left(x \cdot y \leq 400000000000\right):\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + a \cdot b\\
\end{array}
\end{array}
if (*.f64 x y) < -1.3e96 or 4e11 < (*.f64 x y) Initial program 91.9%
Taylor expanded in x around inf 85.2%
if -1.3e96 < (*.f64 x y) < 4e11Initial program 99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in x around 0 89.3%
Final simplification87.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) -1.65e+96) (not (<= (* x y) 1.46e+134))) (* 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) <= -1.65e+96) || !((x * y) <= 1.46e+134)) {
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 (((x * y) <= (-1.65d+96)) .or. (.not. ((x * y) <= 1.46d+134))) 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 (((x * y) <= -1.65e+96) || !((x * y) <= 1.46e+134)) {
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 ((x * y) <= -1.65e+96) or not ((x * y) <= 1.46e+134): 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 ((Float64(x * y) <= -1.65e+96) || !(Float64(x * y) <= 1.46e+134)) 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 (((x * y) <= -1.65e+96) || ~(((x * y) <= 1.46e+134)))
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[N[(x * y), $MachinePrecision], -1.65e+96], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.46e+134]], $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}\;x \cdot y \leq -1.65 \cdot 10^{+96} \lor \neg \left(x \cdot y \leq 1.46 \cdot 10^{+134}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + a \cdot b\\
\end{array}
\end{array}
if (*.f64 x y) < -1.64999999999999992e96 or 1.46e134 < (*.f64 x y) Initial program 89.9%
Taylor expanded in x around inf 89.0%
Taylor expanded in b around inf 76.4%
Taylor expanded in b around 0 77.4%
if -1.64999999999999992e96 < (*.f64 x y) < 1.46e134Initial program 99.4%
fma-define99.4%
Simplified99.4%
Taylor expanded in x around 0 86.3%
Final simplification83.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 (<= (* x y) -9.5e+95) (not (<= (* x y) 1.35e+91))) (* 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 (((x * y) <= -9.5e+95) || !((x * y) <= 1.35e+91)) {
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 (((x * y) <= (-9.5d+95)) .or. (.not. ((x * y) <= 1.35d+91))) 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 (((x * y) <= -9.5e+95) || !((x * y) <= 1.35e+91)) {
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 ((x * y) <= -9.5e+95) or not ((x * y) <= 1.35e+91): 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(x * y) <= -9.5e+95) || !(Float64(x * y) <= 1.35e+91)) 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 (((x * y) <= -9.5e+95) || ~(((x * y) <= 1.35e+91)))
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[Or[LessEqual[N[(x * y), $MachinePrecision], -9.5e+95], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.35e+91]], $MachinePrecision]], 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}\;x \cdot y \leq -9.5 \cdot 10^{+95} \lor \neg \left(x \cdot y \leq 1.35 \cdot 10^{+91}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 x y) < -9.5000000000000004e95 or 1.35e91 < (*.f64 x y) Initial program 90.4%
Taylor expanded in x around inf 87.5%
Taylor expanded in b around inf 74.5%
Taylor expanded in b around 0 75.4%
if -9.5000000000000004e95 < (*.f64 x y) < 1.35e91Initial program 99.4%
fma-define99.4%
Simplified99.4%
Taylor expanded in a around inf 47.7%
Final simplification57.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 (* 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 96.1%
fma-define97.7%
Simplified97.7%
Taylor expanded in a around inf 36.7%
herbie shell --seed 2024137
(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)))