
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= x -4e+143) (fma c i (fma x y (fma z t (* a b)))) (fma x y (fma z t (fma a b (* c i))))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (x <= -4e+143) {
tmp = fma(c, i, fma(x, y, fma(z, t, (a * b))));
} else {
tmp = fma(x, y, fma(z, t, fma(a, b, (c * i))));
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -4e+143) tmp = fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))); else tmp = fma(x, y, fma(z, t, fma(a, b, Float64(c * i)))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -4e+143], N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y + N[(z * t + N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+143}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, \mathsf{fma}\left(a, b, c \cdot i\right)\right)\right)\\
\end{array}
\end{array}
if x < -4.0000000000000001e143Initial program 91.3%
+-commutative91.3%
fma-def97.8%
associate-+l+97.8%
fma-def100.0%
fma-def100.0%
Simplified100.0%
if -4.0000000000000001e143 < x Initial program 94.7%
associate-+l+94.7%
associate-+l+94.7%
fma-def96.2%
fma-def97.6%
fma-def98.6%
Simplified98.6%
Final simplification98.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (fma c i (fma x y (fma z t (* a b)))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, fma(x, y, fma(z, t, (a * b))));
}
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))) end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)
\end{array}
Initial program 94.1%
+-commutative94.1%
fma-def96.1%
associate-+l+96.1%
fma-def97.3%
fma-def97.7%
Simplified97.7%
Final simplification97.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* x y) (* z t))) (t_2 (+ (* c i) (+ (* a b) t_1)))) (if (<= t_2 INFINITY) t_2 (fma c i t_1))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double t_2 = (c * i) + ((a * b) + t_1);
double tmp;
if (t_2 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = fma(c, i, t_1);
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) t_2 = Float64(Float64(c * i) + Float64(Float64(a * b) + t_1)) tmp = 0.0 if (t_2 <= Inf) tmp = t_2; else tmp = fma(c, i, t_1); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, Infinity], t$95$2, N[(c * i + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := c \cdot i + \left(a \cdot b + t_1\right)\\
\mathbf{if}\;t_2 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, t_1\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
+-commutative0.0%
fma-def33.3%
associate-+l+33.3%
fma-def53.3%
fma-def60.0%
Simplified60.0%
fma-udef40.0%
fma-udef33.3%
associate-+l+33.3%
+-commutative33.3%
associate-+r+33.3%
Applied egg-rr33.3%
Taylor expanded in a around 0 40.0%
Final simplification96.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (fma c i (+ (+ (* a b) (* x y)) (* z t))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, (((a * b) + (x * y)) + (z * t)));
}
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) return fma(c, i, Float64(Float64(Float64(a * b) + Float64(x * y)) + Float64(z * t))) end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\mathsf{fma}\left(c, i, \left(a \cdot b + x \cdot y\right) + z \cdot t\right)
\end{array}
Initial program 94.1%
+-commutative94.1%
fma-def96.1%
associate-+l+96.1%
fma-def97.3%
fma-def97.7%
Simplified97.7%
fma-udef96.5%
fma-udef96.1%
associate-+l+96.1%
+-commutative96.1%
associate-+r+96.1%
Applied egg-rr96.1%
Final simplification96.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* c i) (* z t))))
(if (<= (* a b) -1.35e+109)
(* a b)
(if (<= (* a b) -2.2e+14)
(* x y)
(if (<= (* a b) -1.9e-111)
t_1
(if (<= (* a b) -2.05e-190)
(* x y)
(if (<= (* a b) 1.6e-262)
t_1
(if (<= (* a b) 2.6e-248)
(* x y)
(if (<= (* a b) 2.95e+158) t_1 (* a b))))))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + (z * t);
double tmp;
if ((a * b) <= -1.35e+109) {
tmp = a * b;
} else if ((a * b) <= -2.2e+14) {
tmp = x * y;
} else if ((a * b) <= -1.9e-111) {
tmp = t_1;
} else if ((a * b) <= -2.05e-190) {
tmp = x * y;
} else if ((a * b) <= 1.6e-262) {
tmp = t_1;
} else if ((a * b) <= 2.6e-248) {
tmp = x * y;
} else if ((a * b) <= 2.95e+158) {
tmp = t_1;
} else {
tmp = a * b;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (c * i) + (z * t)
if ((a * b) <= (-1.35d+109)) then
tmp = a * b
else if ((a * b) <= (-2.2d+14)) then
tmp = x * y
else if ((a * b) <= (-1.9d-111)) then
tmp = t_1
else if ((a * b) <= (-2.05d-190)) then
tmp = x * y
else if ((a * b) <= 1.6d-262) then
tmp = t_1
else if ((a * b) <= 2.6d-248) then
tmp = x * y
else if ((a * b) <= 2.95d+158) then
tmp = t_1
else
tmp = a * b
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + (z * t);
double tmp;
if ((a * b) <= -1.35e+109) {
tmp = a * b;
} else if ((a * b) <= -2.2e+14) {
tmp = x * y;
} else if ((a * b) <= -1.9e-111) {
tmp = t_1;
} else if ((a * b) <= -2.05e-190) {
tmp = x * y;
} else if ((a * b) <= 1.6e-262) {
tmp = t_1;
} else if ((a * b) <= 2.6e-248) {
tmp = x * y;
} else if ((a * b) <= 2.95e+158) {
tmp = t_1;
} else {
tmp = a * b;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + (z * t) tmp = 0 if (a * b) <= -1.35e+109: tmp = a * b elif (a * b) <= -2.2e+14: tmp = x * y elif (a * b) <= -1.9e-111: tmp = t_1 elif (a * b) <= -2.05e-190: tmp = x * y elif (a * b) <= 1.6e-262: tmp = t_1 elif (a * b) <= 2.6e-248: tmp = x * y elif (a * b) <= 2.95e+158: tmp = t_1 else: tmp = a * b return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(z * t)) tmp = 0.0 if (Float64(a * b) <= -1.35e+109) tmp = Float64(a * b); elseif (Float64(a * b) <= -2.2e+14) tmp = Float64(x * y); elseif (Float64(a * b) <= -1.9e-111) tmp = t_1; elseif (Float64(a * b) <= -2.05e-190) tmp = Float64(x * y); elseif (Float64(a * b) <= 1.6e-262) tmp = t_1; elseif (Float64(a * b) <= 2.6e-248) tmp = Float64(x * y); elseif (Float64(a * b) <= 2.95e+158) tmp = t_1; else tmp = Float64(a * b); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = (c * i) + (z * t);
tmp = 0.0;
if ((a * b) <= -1.35e+109)
tmp = a * b;
elseif ((a * b) <= -2.2e+14)
tmp = x * y;
elseif ((a * b) <= -1.9e-111)
tmp = t_1;
elseif ((a * b) <= -2.05e-190)
tmp = x * y;
elseif ((a * b) <= 1.6e-262)
tmp = t_1;
elseif ((a * b) <= 2.6e-248)
tmp = x * y;
elseif ((a * b) <= 2.95e+158)
tmp = t_1;
else
tmp = a * b;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1.35e+109], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2.2e+14], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.9e-111], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], -2.05e-190], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.6e-262], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2.6e-248], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.95e+158], t$95$1, N[(a * b), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -1.35 \cdot 10^{+109}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -2.2 \cdot 10^{+14}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -1.9 \cdot 10^{-111}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq -2.05 \cdot 10^{-190}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{-262}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 2.6 \cdot 10^{-248}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 2.95 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.35000000000000001e109 or 2.94999999999999987e158 < (*.f64 a b) Initial program 88.7%
Taylor expanded in a around inf 72.0%
if -1.35000000000000001e109 < (*.f64 a b) < -2.2e14 or -1.90000000000000011e-111 < (*.f64 a b) < -2.0500000000000001e-190 or 1.6e-262 < (*.f64 a b) < 2.60000000000000007e-248Initial program 100.0%
Taylor expanded in x around inf 75.4%
if -2.2e14 < (*.f64 a b) < -1.90000000000000011e-111 or -2.0500000000000001e-190 < (*.f64 a b) < 1.6e-262 or 2.60000000000000007e-248 < (*.f64 a b) < 2.94999999999999987e158Initial program 95.8%
Taylor expanded in a around 0 88.6%
Taylor expanded in y around 0 61.2%
Final simplification66.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -3e+108)
(* a b)
(if (<= (* a b) -69000000000000.0)
(* x y)
(if (<= (* a b) -4.8e-106)
(* c i)
(if (<= (* a b) 5.2e-208)
(* x y)
(if (<= (* a b) 3.9e-128)
(* z t)
(if (<= (* a b) 1.05e-105)
(* x y)
(if (<= (* a b) 3.8e+128) (* z t) (* a b)))))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -3e+108) {
tmp = a * b;
} else if ((a * b) <= -69000000000000.0) {
tmp = x * y;
} else if ((a * b) <= -4.8e-106) {
tmp = c * i;
} else if ((a * b) <= 5.2e-208) {
tmp = x * y;
} else if ((a * b) <= 3.9e-128) {
tmp = z * t;
} else if ((a * b) <= 1.05e-105) {
tmp = x * y;
} else if ((a * b) <= 3.8e+128) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((a * b) <= (-3d+108)) then
tmp = a * b
else if ((a * b) <= (-69000000000000.0d0)) then
tmp = x * y
else if ((a * b) <= (-4.8d-106)) then
tmp = c * i
else if ((a * b) <= 5.2d-208) then
tmp = x * y
else if ((a * b) <= 3.9d-128) then
tmp = z * t
else if ((a * b) <= 1.05d-105) then
tmp = x * y
else if ((a * b) <= 3.8d+128) then
tmp = z * t
else
tmp = a * b
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -3e+108) {
tmp = a * b;
} else if ((a * b) <= -69000000000000.0) {
tmp = x * y;
} else if ((a * b) <= -4.8e-106) {
tmp = c * i;
} else if ((a * b) <= 5.2e-208) {
tmp = x * y;
} else if ((a * b) <= 3.9e-128) {
tmp = z * t;
} else if ((a * b) <= 1.05e-105) {
tmp = x * y;
} else if ((a * b) <= 3.8e+128) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -3e+108: tmp = a * b elif (a * b) <= -69000000000000.0: tmp = x * y elif (a * b) <= -4.8e-106: tmp = c * i elif (a * b) <= 5.2e-208: tmp = x * y elif (a * b) <= 3.9e-128: tmp = z * t elif (a * b) <= 1.05e-105: tmp = x * y elif (a * b) <= 3.8e+128: tmp = z * t else: tmp = a * b return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -3e+108) tmp = Float64(a * b); elseif (Float64(a * b) <= -69000000000000.0) tmp = Float64(x * y); elseif (Float64(a * b) <= -4.8e-106) tmp = Float64(c * i); elseif (Float64(a * b) <= 5.2e-208) tmp = Float64(x * y); elseif (Float64(a * b) <= 3.9e-128) tmp = Float64(z * t); elseif (Float64(a * b) <= 1.05e-105) tmp = Float64(x * y); elseif (Float64(a * b) <= 3.8e+128) tmp = Float64(z * t); else tmp = Float64(a * b); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((a * b) <= -3e+108)
tmp = a * b;
elseif ((a * b) <= -69000000000000.0)
tmp = x * y;
elseif ((a * b) <= -4.8e-106)
tmp = c * i;
elseif ((a * b) <= 5.2e-208)
tmp = x * y;
elseif ((a * b) <= 3.9e-128)
tmp = z * t;
elseif ((a * b) <= 1.05e-105)
tmp = x * y;
elseif ((a * b) <= 3.8e+128)
tmp = z * t;
else
tmp = a * b;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -3e+108], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -69000000000000.0], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -4.8e-106], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.2e-208], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.9e-128], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.05e-105], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.8e+128], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3 \cdot 10^{+108}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -69000000000000:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -4.8 \cdot 10^{-106}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 5.2 \cdot 10^{-208}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 3.9 \cdot 10^{-128}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.05 \cdot 10^{-105}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 3.8 \cdot 10^{+128}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -2.99999999999999984e108 or 3.7999999999999999e128 < (*.f64 a b) Initial program 88.5%
Taylor expanded in a around inf 68.9%
if -2.99999999999999984e108 < (*.f64 a b) < -6.9e13 or -4.7999999999999995e-106 < (*.f64 a b) < 5.20000000000000034e-208 or 3.89999999999999997e-128 < (*.f64 a b) < 1.05e-105Initial program 97.3%
Taylor expanded in x around inf 57.0%
if -6.9e13 < (*.f64 a b) < -4.7999999999999995e-106Initial program 92.3%
Taylor expanded in c around inf 56.0%
if 5.20000000000000034e-208 < (*.f64 a b) < 3.89999999999999997e-128 or 1.05e-105 < (*.f64 a b) < 3.7999999999999999e128Initial program 97.8%
Taylor expanded in z around inf 49.1%
Final simplification59.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t)))))) (if (<= t_1 INFINITY) t_1 (* c i))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = c * i;
}
return tmp;
}
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = c * i;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + ((a * b) + ((x * y) + (z * t))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = c * i return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(c * i); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
tmp = 0.0;
if (t_1 <= Inf)
tmp = t_1;
else
tmp = c * i;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(c * i), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
Taylor expanded in c around inf 34.0%
Final simplification96.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))) (t_2 (+ (* c i) (* z t))))
(if (<= (* a b) -1.8e+109)
(* a b)
(if (<= (* a b) -5800000000000.0)
t_1
(if (<= (* a b) -1.58e-105)
t_2
(if (<= (* a b) 4e-69)
t_1
(if (<= (* a b) 2.05e+157) t_2 (* a b))))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double t_2 = (c * i) + (z * t);
double tmp;
if ((a * b) <= -1.8e+109) {
tmp = a * b;
} else if ((a * b) <= -5800000000000.0) {
tmp = t_1;
} else if ((a * b) <= -1.58e-105) {
tmp = t_2;
} else if ((a * b) <= 4e-69) {
tmp = t_1;
} else if ((a * b) <= 2.05e+157) {
tmp = t_2;
} else {
tmp = a * b;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * y) + (z * t)
t_2 = (c * i) + (z * t)
if ((a * b) <= (-1.8d+109)) then
tmp = a * b
else if ((a * b) <= (-5800000000000.0d0)) then
tmp = t_1
else if ((a * b) <= (-1.58d-105)) then
tmp = t_2
else if ((a * b) <= 4d-69) then
tmp = t_1
else if ((a * b) <= 2.05d+157) then
tmp = t_2
else
tmp = a * b
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double t_2 = (c * i) + (z * t);
double tmp;
if ((a * b) <= -1.8e+109) {
tmp = a * b;
} else if ((a * b) <= -5800000000000.0) {
tmp = t_1;
} else if ((a * b) <= -1.58e-105) {
tmp = t_2;
} else if ((a * b) <= 4e-69) {
tmp = t_1;
} else if ((a * b) <= 2.05e+157) {
tmp = t_2;
} else {
tmp = a * b;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) t_2 = (c * i) + (z * t) tmp = 0 if (a * b) <= -1.8e+109: tmp = a * b elif (a * b) <= -5800000000000.0: tmp = t_1 elif (a * b) <= -1.58e-105: tmp = t_2 elif (a * b) <= 4e-69: tmp = t_1 elif (a * b) <= 2.05e+157: tmp = t_2 else: tmp = a * b return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) t_2 = Float64(Float64(c * i) + Float64(z * t)) tmp = 0.0 if (Float64(a * b) <= -1.8e+109) tmp = Float64(a * b); elseif (Float64(a * b) <= -5800000000000.0) tmp = t_1; elseif (Float64(a * b) <= -1.58e-105) tmp = t_2; elseif (Float64(a * b) <= 4e-69) tmp = t_1; elseif (Float64(a * b) <= 2.05e+157) tmp = t_2; else tmp = Float64(a * b); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = (x * y) + (z * t);
t_2 = (c * i) + (z * t);
tmp = 0.0;
if ((a * b) <= -1.8e+109)
tmp = a * b;
elseif ((a * b) <= -5800000000000.0)
tmp = t_1;
elseif ((a * b) <= -1.58e-105)
tmp = t_2;
elseif ((a * b) <= 4e-69)
tmp = t_1;
elseif ((a * b) <= 2.05e+157)
tmp = t_2;
else
tmp = a * b;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1.8e+109], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -5800000000000.0], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], -1.58e-105], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 4e-69], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2.05e+157], t$95$2, N[(a * b), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := c \cdot i + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -1.8 \cdot 10^{+109}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -5800000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq -1.58 \cdot 10^{-105}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{-69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 2.05 \cdot 10^{+157}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.8e109 or 2.05000000000000008e157 < (*.f64 a b) Initial program 88.7%
Taylor expanded in a around inf 72.0%
if -1.8e109 < (*.f64 a b) < -5.8e12 or -1.57999999999999997e-105 < (*.f64 a b) < 3.9999999999999999e-69Initial program 97.6%
Taylor expanded in a around 0 96.8%
Taylor expanded in c around 0 80.3%
if -5.8e12 < (*.f64 a b) < -1.57999999999999997e-105 or 3.9999999999999999e-69 < (*.f64 a b) < 2.05000000000000008e157Initial program 94.1%
Taylor expanded in a around 0 73.5%
Taylor expanded in y around 0 65.7%
Final simplification74.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (or (<= (* a b) -7.8e+108) (not (<= (* a b) 1.85e+43)))
(+ (* a b) t_1)
(+ (* c i) t_1))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if (((a * b) <= -7.8e+108) || !((a * b) <= 1.85e+43)) {
tmp = (a * b) + t_1;
} else {
tmp = (c * i) + t_1;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) + (z * t)
if (((a * b) <= (-7.8d+108)) .or. (.not. ((a * b) <= 1.85d+43))) then
tmp = (a * b) + t_1
else
tmp = (c * i) + t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if (((a * b) <= -7.8e+108) || !((a * b) <= 1.85e+43)) {
tmp = (a * b) + t_1;
} else {
tmp = (c * i) + t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if ((a * b) <= -7.8e+108) or not ((a * b) <= 1.85e+43): tmp = (a * b) + t_1 else: tmp = (c * i) + t_1 return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if ((Float64(a * b) <= -7.8e+108) || !(Float64(a * b) <= 1.85e+43)) tmp = Float64(Float64(a * b) + t_1); else tmp = Float64(Float64(c * i) + t_1); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = (x * y) + (z * t);
tmp = 0.0;
if (((a * b) <= -7.8e+108) || ~(((a * b) <= 1.85e+43)))
tmp = (a * b) + t_1;
else
tmp = (c * i) + t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(a * b), $MachinePrecision], -7.8e+108], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.85e+43]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -7.8 \cdot 10^{+108} \lor \neg \left(a \cdot b \leq 1.85 \cdot 10^{+43}\right):\\
\;\;\;\;a \cdot b + t_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + t_1\\
\end{array}
\end{array}
if (*.f64 a b) < -7.79999999999999969e108 or 1.85e43 < (*.f64 a b) Initial program 90.0%
Taylor expanded in c around 0 84.3%
if -7.79999999999999969e108 < (*.f64 a b) < 1.85e43Initial program 96.8%
Taylor expanded in a around 0 93.7%
Final simplification90.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -3.5e+195) (+ (* c i) (* z t)) (if (<= (* c i) 4.5e+258) (+ (* a b) (+ (* x y) (* z t))) (* c i))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -3.5e+195) {
tmp = (c * i) + (z * t);
} else if ((c * i) <= 4.5e+258) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = c * i;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((c * i) <= (-3.5d+195)) then
tmp = (c * i) + (z * t)
else if ((c * i) <= 4.5d+258) then
tmp = (a * b) + ((x * y) + (z * t))
else
tmp = c * i
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -3.5e+195) {
tmp = (c * i) + (z * t);
} else if ((c * i) <= 4.5e+258) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = c * i;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -3.5e+195: tmp = (c * i) + (z * t) elif (c * i) <= 4.5e+258: tmp = (a * b) + ((x * y) + (z * t)) else: tmp = c * i return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -3.5e+195) tmp = Float64(Float64(c * i) + Float64(z * t)); elseif (Float64(c * i) <= 4.5e+258) tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); else tmp = Float64(c * i); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((c * i) <= -3.5e+195)
tmp = (c * i) + (z * t);
elseif ((c * i) <= 4.5e+258)
tmp = (a * b) + ((x * y) + (z * t));
else
tmp = c * i;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -3.5e+195], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 4.5e+258], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * i), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.5 \cdot 10^{+195}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 4.5 \cdot 10^{+258}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -3.5000000000000002e195Initial program 84.6%
Taylor expanded in a around 0 81.0%
Taylor expanded in y around 0 77.2%
if -3.5000000000000002e195 < (*.f64 c i) < 4.5000000000000004e258Initial program 97.6%
Taylor expanded in c around 0 88.7%
if 4.5000000000000004e258 < (*.f64 c i) Initial program 71.4%
Taylor expanded in c around inf 81.0%
Final simplification86.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1.75e+103) (* a b) (if (<= (* a b) 7.4e+151) (* c i) (* a b))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1.75e+103) {
tmp = a * b;
} else if ((a * b) <= 7.4e+151) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((a * b) <= (-1.75d+103)) then
tmp = a * b
else if ((a * b) <= 7.4d+151) then
tmp = c * i
else
tmp = a * b
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1.75e+103) {
tmp = a * b;
} else if ((a * b) <= 7.4e+151) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1.75e+103: tmp = a * b elif (a * b) <= 7.4e+151: tmp = c * i else: tmp = a * b return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1.75e+103) tmp = Float64(a * b); elseif (Float64(a * b) <= 7.4e+151) tmp = Float64(c * i); else tmp = Float64(a * b); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((a * b) <= -1.75e+103)
tmp = a * b;
elseif ((a * b) <= 7.4e+151)
tmp = c * i;
else
tmp = a * b;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.75e+103], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 7.4e+151], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.75 \cdot 10^{+103}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 7.4 \cdot 10^{+151}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.75e103 or 7.3999999999999995e151 < (*.f64 a b) Initial program 89.1%
Taylor expanded in a around inf 70.8%
if -1.75e103 < (*.f64 a b) < 7.3999999999999995e151Initial program 96.5%
Taylor expanded in c around inf 28.5%
Final simplification42.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1.7e+103) (* a b) (if (<= (* a b) 6e+127) (* z t) (* a b))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1.7e+103) {
tmp = a * b;
} else if ((a * b) <= 6e+127) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((a * b) <= (-1.7d+103)) then
tmp = a * b
else if ((a * b) <= 6d+127) then
tmp = z * t
else
tmp = a * b
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1.7e+103) {
tmp = a * b;
} else if ((a * b) <= 6e+127) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1.7e+103: tmp = a * b elif (a * b) <= 6e+127: tmp = z * t else: tmp = a * b return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1.7e+103) tmp = Float64(a * b); elseif (Float64(a * b) <= 6e+127) tmp = Float64(z * t); else tmp = Float64(a * b); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((a * b) <= -1.7e+103)
tmp = a * b;
elseif ((a * b) <= 6e+127)
tmp = z * t;
else
tmp = a * b;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.7e+103], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 6e+127], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.7 \cdot 10^{+103}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 6 \cdot 10^{+127}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.6999999999999999e103 or 6.0000000000000005e127 < (*.f64 a b) Initial program 88.6%
Taylor expanded in a around inf 68.2%
if -1.6999999999999999e103 < (*.f64 a b) < 6.0000000000000005e127Initial program 97.0%
Taylor expanded in z around inf 32.2%
Final simplification44.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (* a b))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = a * b
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c, i): return a * b
x, y = sort([x, y]) function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a, b, c, i)
tmp = a * b;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
a \cdot b
\end{array}
Initial program 94.1%
Taylor expanded in a around inf 27.8%
Final simplification27.8%
herbie shell --seed 2023195
(FPCore (x y z t a b c i)
:name "Linear.V4:$cdot from linear-1.19.1.3, C"
:precision binary64
(+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))