
(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 16 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: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= i 8.2e+261) (fma c i (fma x y (fma z t (* a b)))) (+ (* c i) (+ (* a b) (* z t)))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (i <= 8.2e+261) {
tmp = fma(c, i, fma(x, y, fma(z, t, (a * b))));
} else {
tmp = (c * i) + ((a * b) + (z * t));
}
return tmp;
}
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (i <= 8.2e+261) tmp = fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))); else tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t))); end return tmp end
NOTE: c and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[i, 8.2e+261], N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;i \leq 8.2 \cdot 10^{+261}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\end{array}
\end{array}
if i < 8.1999999999999999e261Initial program 96.3%
+-commutative96.3%
fma-def97.1%
associate-+l+97.1%
fma-def97.5%
fma-def97.5%
Simplified97.5%
if 8.1999999999999999e261 < i Initial program 83.3%
Taylor expanded in x around 0 100.0%
Final simplification97.7%
NOTE: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (fma x y (fma z t (fma a b (* c i)))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(x, y, fma(z, t, fma(a, b, (c * i))));
}
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) return fma(x, y, fma(z, t, fma(a, b, Float64(c * i)))) end
NOTE: c and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(x * y + N[(z * t + N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, \mathsf{fma}\left(a, b, c \cdot i\right)\right)\right)
\end{array}
Initial program 95.7%
associate-+l+95.7%
associate-+l+95.7%
fma-def98.0%
fma-def98.0%
fma-def98.4%
Simplified98.4%
Final simplification98.4%
NOTE: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (+ (* c i) (+ (* a b) (+ (* z t) (* x y)))) INFINITY) (+ (fma z t (* a b)) (+ (* c i) (* x y))) (fma x y (+ (* c i) (* z t)))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) + ((a * b) + ((z * t) + (x * y)))) <= ((double) INFINITY)) {
tmp = fma(z, t, (a * b)) + ((c * i) + (x * y));
} else {
tmp = fma(x, y, ((c * i) + (z * t)));
}
return tmp;
}
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y)))) <= Inf) tmp = Float64(fma(z, t, Float64(a * b)) + Float64(Float64(c * i) + Float64(x * y))); else tmp = fma(x, y, Float64(Float64(c * i) + Float64(z * t))); end return tmp end
NOTE: c and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y + N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i + \left(a \cdot b + \left(z \cdot t + x \cdot y\right)\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(z, t, a \cdot b\right) + \left(c \cdot i + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c \cdot i + z \cdot t\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%
+-commutative100.0%
fma-def100.0%
associate-+l+100.0%
fma-def100.0%
fma-def100.0%
Simplified100.0%
fma-udef100.0%
fma-udef100.0%
associate-+r+100.0%
Applied egg-rr100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
associate-+l+0.0%
associate-+l+0.0%
fma-def54.5%
fma-def54.5%
fma-def63.6%
Simplified63.6%
Taylor expanded in a around 0 72.7%
Final simplification98.8%
NOTE: c and i 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) (+ (* z t) (* x y)))))) (if (<= t_1 INFINITY) t_1 (fma x y (+ (* c i) (* z t))))))
assert(c < i);
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) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(x, y, ((c * i) + (z * t)));
}
return tmp;
}
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(x, y, Float64(Float64(c * i) + Float64(z * t))); end return tmp end
NOTE: c and i 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[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(x * y + N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(z \cdot t + x \cdot y\right)\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c \cdot i + z \cdot t\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%
associate-+l+0.0%
associate-+l+0.0%
fma-def54.5%
fma-def54.5%
fma-def63.6%
Simplified63.6%
Taylor expanded in a around 0 72.7%
Final simplification98.8%
NOTE: c and i 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) (+ (* z t) (* x y)))))) (if (<= t_1 INFINITY) t_1 (+ (* c i) (* z t)))))
assert(c < i);
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) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (c * i) + (z * t);
}
return tmp;
}
assert c < i;
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) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (c * i) + (z * t);
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + ((a * b) + ((z * t) + (x * y))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (c * i) + (z * t) return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(c * i) + Float64(z * t)); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = (c * i) + ((a * b) + ((z * t) + (x * y)));
tmp = 0.0;
if (t_1 <= Inf)
tmp = t_1;
else
tmp = (c * i) + (z * t);
end
tmp_2 = tmp;
end
NOTE: c and i 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[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(z \cdot t + x \cdot y\right)\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\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 a around 0 27.3%
+-commutative27.3%
*-commutative27.3%
fma-udef27.3%
*-commutative27.3%
Simplified27.3%
Taylor expanded in y around 0 64.3%
Final simplification98.4%
NOTE: c and i 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)))
(t_2 (+ (* c i) (* a b)))
(t_3 (+ (* z t) (* x y)))
(t_4 (+ (* a b) (* x y))))
(if (<= z -6.6e+202)
t_3
(if (<= z -3.7e+80)
t_1
(if (<= z -7.2e+56)
t_4
(if (<= z -3.3e+14)
t_1
(if (<= z -2.4e-74)
t_4
(if (<= z -4e-194)
t_2
(if (<= z 3.6e-280) t_4 (if (<= z 4.2e+32) t_2 t_3))))))))))assert(c < i);
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 t_2 = (c * i) + (a * b);
double t_3 = (z * t) + (x * y);
double t_4 = (a * b) + (x * y);
double tmp;
if (z <= -6.6e+202) {
tmp = t_3;
} else if (z <= -3.7e+80) {
tmp = t_1;
} else if (z <= -7.2e+56) {
tmp = t_4;
} else if (z <= -3.3e+14) {
tmp = t_1;
} else if (z <= -2.4e-74) {
tmp = t_4;
} else if (z <= -4e-194) {
tmp = t_2;
} else if (z <= 3.6e-280) {
tmp = t_4;
} else if (z <= 4.2e+32) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
NOTE: c and i 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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = (c * i) + (z * t)
t_2 = (c * i) + (a * b)
t_3 = (z * t) + (x * y)
t_4 = (a * b) + (x * y)
if (z <= (-6.6d+202)) then
tmp = t_3
else if (z <= (-3.7d+80)) then
tmp = t_1
else if (z <= (-7.2d+56)) then
tmp = t_4
else if (z <= (-3.3d+14)) then
tmp = t_1
else if (z <= (-2.4d-74)) then
tmp = t_4
else if (z <= (-4d-194)) then
tmp = t_2
else if (z <= 3.6d-280) then
tmp = t_4
else if (z <= 4.2d+32) then
tmp = t_2
else
tmp = t_3
end if
code = tmp
end function
assert c < i;
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 t_2 = (c * i) + (a * b);
double t_3 = (z * t) + (x * y);
double t_4 = (a * b) + (x * y);
double tmp;
if (z <= -6.6e+202) {
tmp = t_3;
} else if (z <= -3.7e+80) {
tmp = t_1;
} else if (z <= -7.2e+56) {
tmp = t_4;
} else if (z <= -3.3e+14) {
tmp = t_1;
} else if (z <= -2.4e-74) {
tmp = t_4;
} else if (z <= -4e-194) {
tmp = t_2;
} else if (z <= 3.6e-280) {
tmp = t_4;
} else if (z <= 4.2e+32) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + (z * t) t_2 = (c * i) + (a * b) t_3 = (z * t) + (x * y) t_4 = (a * b) + (x * y) tmp = 0 if z <= -6.6e+202: tmp = t_3 elif z <= -3.7e+80: tmp = t_1 elif z <= -7.2e+56: tmp = t_4 elif z <= -3.3e+14: tmp = t_1 elif z <= -2.4e-74: tmp = t_4 elif z <= -4e-194: tmp = t_2 elif z <= 3.6e-280: tmp = t_4 elif z <= 4.2e+32: tmp = t_2 else: tmp = t_3 return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(z * t)) t_2 = Float64(Float64(c * i) + Float64(a * b)) t_3 = Float64(Float64(z * t) + Float64(x * y)) t_4 = Float64(Float64(a * b) + Float64(x * y)) tmp = 0.0 if (z <= -6.6e+202) tmp = t_3; elseif (z <= -3.7e+80) tmp = t_1; elseif (z <= -7.2e+56) tmp = t_4; elseif (z <= -3.3e+14) tmp = t_1; elseif (z <= -2.4e-74) tmp = t_4; elseif (z <= -4e-194) tmp = t_2; elseif (z <= 3.6e-280) tmp = t_4; elseif (z <= 4.2e+32) tmp = t_2; else tmp = t_3; end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = (c * i) + (z * t);
t_2 = (c * i) + (a * b);
t_3 = (z * t) + (x * y);
t_4 = (a * b) + (x * y);
tmp = 0.0;
if (z <= -6.6e+202)
tmp = t_3;
elseif (z <= -3.7e+80)
tmp = t_1;
elseif (z <= -7.2e+56)
tmp = t_4;
elseif (z <= -3.3e+14)
tmp = t_1;
elseif (z <= -2.4e-74)
tmp = t_4;
elseif (z <= -4e-194)
tmp = t_2;
elseif (z <= 3.6e-280)
tmp = t_4;
elseif (z <= 4.2e+32)
tmp = t_2;
else
tmp = t_3;
end
tmp_2 = tmp;
end
NOTE: c and i 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]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.6e+202], t$95$3, If[LessEqual[z, -3.7e+80], t$95$1, If[LessEqual[z, -7.2e+56], t$95$4, If[LessEqual[z, -3.3e+14], t$95$1, If[LessEqual[z, -2.4e-74], t$95$4, If[LessEqual[z, -4e-194], t$95$2, If[LessEqual[z, 3.6e-280], t$95$4, If[LessEqual[z, 4.2e+32], t$95$2, t$95$3]]]]]]]]]]]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
t_2 := c \cdot i + a \cdot b\\
t_3 := z \cdot t + x \cdot y\\
t_4 := a \cdot b + x \cdot y\\
\mathbf{if}\;z \leq -6.6 \cdot 10^{+202}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{+80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{+56}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{+14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{-74}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-194}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-280}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+32}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if z < -6.5999999999999998e202 or 4.2000000000000001e32 < z Initial program 96.2%
Taylor expanded in c around 0 79.4%
Taylor expanded in a around 0 64.5%
if -6.5999999999999998e202 < z < -3.69999999999999996e80 or -7.19999999999999996e56 < z < -3.3e14Initial program 94.9%
Taylor expanded in a around 0 85.2%
+-commutative85.2%
*-commutative85.2%
fma-udef85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in y around 0 76.9%
if -3.69999999999999996e80 < z < -7.19999999999999996e56 or -3.3e14 < z < -2.3999999999999999e-74 or -4.00000000000000007e-194 < z < 3.59999999999999994e-280Initial program 97.8%
Taylor expanded in c around 0 83.2%
Taylor expanded in t around 0 76.9%
if -2.3999999999999999e-74 < z < -4.00000000000000007e-194 or 3.59999999999999994e-280 < z < 4.2000000000000001e32Initial program 94.4%
Taylor expanded in x around 0 68.9%
Taylor expanded in t around 0 62.0%
Final simplification67.8%
NOTE: c and i 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)))
(t_2 (+ (* a b) (* x y)))
(t_3 (+ (* c i) (* a b))))
(if (<= z -6e+84)
t_1
(if (<= z -1.35e+47)
t_2
(if (<= z -3200000000000.0)
t_1
(if (<= z -2.8e-75)
t_2
(if (<= z -9e-194)
t_3
(if (<= z 4.8e-280)
t_2
(if (<= z 520000.0) t_3 (+ (* a b) (* z t)))))))))))assert(c < i);
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 t_2 = (a * b) + (x * y);
double t_3 = (c * i) + (a * b);
double tmp;
if (z <= -6e+84) {
tmp = t_1;
} else if (z <= -1.35e+47) {
tmp = t_2;
} else if (z <= -3200000000000.0) {
tmp = t_1;
} else if (z <= -2.8e-75) {
tmp = t_2;
} else if (z <= -9e-194) {
tmp = t_3;
} else if (z <= 4.8e-280) {
tmp = t_2;
} else if (z <= 520000.0) {
tmp = t_3;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
NOTE: c and i 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) :: t_3
real(8) :: tmp
t_1 = (c * i) + (z * t)
t_2 = (a * b) + (x * y)
t_3 = (c * i) + (a * b)
if (z <= (-6d+84)) then
tmp = t_1
else if (z <= (-1.35d+47)) then
tmp = t_2
else if (z <= (-3200000000000.0d0)) then
tmp = t_1
else if (z <= (-2.8d-75)) then
tmp = t_2
else if (z <= (-9d-194)) then
tmp = t_3
else if (z <= 4.8d-280) then
tmp = t_2
else if (z <= 520000.0d0) then
tmp = t_3
else
tmp = (a * b) + (z * t)
end if
code = tmp
end function
assert c < i;
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 t_2 = (a * b) + (x * y);
double t_3 = (c * i) + (a * b);
double tmp;
if (z <= -6e+84) {
tmp = t_1;
} else if (z <= -1.35e+47) {
tmp = t_2;
} else if (z <= -3200000000000.0) {
tmp = t_1;
} else if (z <= -2.8e-75) {
tmp = t_2;
} else if (z <= -9e-194) {
tmp = t_3;
} else if (z <= 4.8e-280) {
tmp = t_2;
} else if (z <= 520000.0) {
tmp = t_3;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + (z * t) t_2 = (a * b) + (x * y) t_3 = (c * i) + (a * b) tmp = 0 if z <= -6e+84: tmp = t_1 elif z <= -1.35e+47: tmp = t_2 elif z <= -3200000000000.0: tmp = t_1 elif z <= -2.8e-75: tmp = t_2 elif z <= -9e-194: tmp = t_3 elif z <= 4.8e-280: tmp = t_2 elif z <= 520000.0: tmp = t_3 else: tmp = (a * b) + (z * t) return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(z * t)) t_2 = Float64(Float64(a * b) + Float64(x * y)) t_3 = Float64(Float64(c * i) + Float64(a * b)) tmp = 0.0 if (z <= -6e+84) tmp = t_1; elseif (z <= -1.35e+47) tmp = t_2; elseif (z <= -3200000000000.0) tmp = t_1; elseif (z <= -2.8e-75) tmp = t_2; elseif (z <= -9e-194) tmp = t_3; elseif (z <= 4.8e-280) tmp = t_2; elseif (z <= 520000.0) tmp = t_3; else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = (c * i) + (z * t);
t_2 = (a * b) + (x * y);
t_3 = (c * i) + (a * b);
tmp = 0.0;
if (z <= -6e+84)
tmp = t_1;
elseif (z <= -1.35e+47)
tmp = t_2;
elseif (z <= -3200000000000.0)
tmp = t_1;
elseif (z <= -2.8e-75)
tmp = t_2;
elseif (z <= -9e-194)
tmp = t_3;
elseif (z <= 4.8e-280)
tmp = t_2;
elseif (z <= 520000.0)
tmp = t_3;
else
tmp = (a * b) + (z * t);
end
tmp_2 = tmp;
end
NOTE: c and i 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]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6e+84], t$95$1, If[LessEqual[z, -1.35e+47], t$95$2, If[LessEqual[z, -3200000000000.0], t$95$1, If[LessEqual[z, -2.8e-75], t$95$2, If[LessEqual[z, -9e-194], t$95$3, If[LessEqual[z, 4.8e-280], t$95$2, If[LessEqual[z, 520000.0], t$95$3, N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
t_2 := a \cdot b + x \cdot y\\
t_3 := c \cdot i + a \cdot b\\
\mathbf{if}\;z \leq -6 \cdot 10^{+84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{+47}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -3200000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-75}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-194}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-280}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 520000:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if z < -5.99999999999999992e84 or -1.34999999999999998e47 < z < -3.2e12Initial program 94.8%
Taylor expanded in a around 0 86.2%
+-commutative86.2%
*-commutative86.2%
fma-udef86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in y around 0 78.9%
if -5.99999999999999992e84 < z < -1.34999999999999998e47 or -3.2e12 < z < -2.79999999999999998e-75 or -8.9999999999999997e-194 < z < 4.7999999999999996e-280Initial program 97.8%
Taylor expanded in c around 0 83.2%
Taylor expanded in t around 0 76.9%
if -2.79999999999999998e-75 < z < -8.9999999999999997e-194 or 4.7999999999999996e-280 < z < 5.2e5Initial program 94.2%
Taylor expanded in x around 0 67.5%
Taylor expanded in t around 0 61.3%
if 5.2e5 < z Initial program 96.9%
Taylor expanded in c around 0 76.2%
Taylor expanded in y around 0 64.3%
Final simplification68.9%
NOTE: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -1.06e+77) (not (<= (* c i) 1.3e+80))) (+ (* c i) (* a b)) (+ (* a b) (+ (* z t) (* x y)))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -1.06e+77) || !((c * i) <= 1.3e+80)) {
tmp = (c * i) + (a * b);
} else {
tmp = (a * b) + ((z * t) + (x * y));
}
return tmp;
}
NOTE: c and i 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) <= (-1.06d+77)) .or. (.not. ((c * i) <= 1.3d+80))) then
tmp = (c * i) + (a * b)
else
tmp = (a * b) + ((z * t) + (x * y))
end if
code = tmp
end function
assert c < i;
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) <= -1.06e+77) || !((c * i) <= 1.3e+80)) {
tmp = (c * i) + (a * b);
} else {
tmp = (a * b) + ((z * t) + (x * y));
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -1.06e+77) or not ((c * i) <= 1.3e+80): tmp = (c * i) + (a * b) else: tmp = (a * b) + ((z * t) + (x * y)) return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -1.06e+77) || !(Float64(c * i) <= 1.3e+80)) tmp = Float64(Float64(c * i) + Float64(a * b)); else tmp = Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if (((c * i) <= -1.06e+77) || ~(((c * i) <= 1.3e+80)))
tmp = (c * i) + (a * b);
else
tmp = (a * b) + ((z * t) + (x * y));
end
tmp_2 = tmp;
end
NOTE: c and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -1.06e+77], N[Not[LessEqual[N[(c * i), $MachinePrecision], 1.3e+80]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.06 \cdot 10^{+77} \lor \neg \left(c \cdot i \leq 1.3 \cdot 10^{+80}\right):\\
\;\;\;\;c \cdot i + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(z \cdot t + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -1.06000000000000003e77 or 1.29999999999999991e80 < (*.f64 c i) Initial program 90.8%
Taylor expanded in x around 0 87.0%
Taylor expanded in t around 0 77.6%
if -1.06000000000000003e77 < (*.f64 c i) < 1.29999999999999991e80Initial program 98.7%
Taylor expanded in c around 0 92.6%
Final simplification86.9%
NOTE: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -8.6e+76) (not (<= (* c i) 1.35e+80))) (+ (* c i) (+ (* a b) (* z t))) (+ (* a b) (+ (* z t) (* x y)))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -8.6e+76) || !((c * i) <= 1.35e+80)) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = (a * b) + ((z * t) + (x * y));
}
return tmp;
}
NOTE: c and i 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) <= (-8.6d+76)) .or. (.not. ((c * i) <= 1.35d+80))) then
tmp = (c * i) + ((a * b) + (z * t))
else
tmp = (a * b) + ((z * t) + (x * y))
end if
code = tmp
end function
assert c < i;
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) <= -8.6e+76) || !((c * i) <= 1.35e+80)) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = (a * b) + ((z * t) + (x * y));
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -8.6e+76) or not ((c * i) <= 1.35e+80): tmp = (c * i) + ((a * b) + (z * t)) else: tmp = (a * b) + ((z * t) + (x * y)) return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -8.6e+76) || !(Float64(c * i) <= 1.35e+80)) tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t))); else tmp = Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if (((c * i) <= -8.6e+76) || ~(((c * i) <= 1.35e+80)))
tmp = (c * i) + ((a * b) + (z * t));
else
tmp = (a * b) + ((z * t) + (x * y));
end
tmp_2 = tmp;
end
NOTE: c and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -8.6e+76], N[Not[LessEqual[N[(c * i), $MachinePrecision], 1.35e+80]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -8.6 \cdot 10^{+76} \lor \neg \left(c \cdot i \leq 1.35 \cdot 10^{+80}\right):\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(z \cdot t + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -8.59999999999999957e76 or 1.34999999999999991e80 < (*.f64 c i) Initial program 90.8%
Taylor expanded in x around 0 87.0%
if -8.59999999999999957e76 < (*.f64 c i) < 1.34999999999999991e80Initial program 98.7%
Taylor expanded in c around 0 92.6%
Final simplification90.4%
NOTE: c and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(if (<= z -4.3e+98)
(* z t)
(if (<= z -3.6e+14)
(* c i)
(if (<= z -1.9e-67)
(* x y)
(if (<= z -1.12e-194)
(* c i)
(if (<= z 1.15e-279)
(* x y)
(if (<= z 3800000.0) (* a b) (* z t))))))))assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (z <= -4.3e+98) {
tmp = z * t;
} else if (z <= -3.6e+14) {
tmp = c * i;
} else if (z <= -1.9e-67) {
tmp = x * y;
} else if (z <= -1.12e-194) {
tmp = c * i;
} else if (z <= 1.15e-279) {
tmp = x * y;
} else if (z <= 3800000.0) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
NOTE: c and i 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 (z <= (-4.3d+98)) then
tmp = z * t
else if (z <= (-3.6d+14)) then
tmp = c * i
else if (z <= (-1.9d-67)) then
tmp = x * y
else if (z <= (-1.12d-194)) then
tmp = c * i
else if (z <= 1.15d-279) then
tmp = x * y
else if (z <= 3800000.0d0) then
tmp = a * b
else
tmp = z * t
end if
code = tmp
end function
assert c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (z <= -4.3e+98) {
tmp = z * t;
} else if (z <= -3.6e+14) {
tmp = c * i;
} else if (z <= -1.9e-67) {
tmp = x * y;
} else if (z <= -1.12e-194) {
tmp = c * i;
} else if (z <= 1.15e-279) {
tmp = x * y;
} else if (z <= 3800000.0) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if z <= -4.3e+98: tmp = z * t elif z <= -3.6e+14: tmp = c * i elif z <= -1.9e-67: tmp = x * y elif z <= -1.12e-194: tmp = c * i elif z <= 1.15e-279: tmp = x * y elif z <= 3800000.0: tmp = a * b else: tmp = z * t return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (z <= -4.3e+98) tmp = Float64(z * t); elseif (z <= -3.6e+14) tmp = Float64(c * i); elseif (z <= -1.9e-67) tmp = Float64(x * y); elseif (z <= -1.12e-194) tmp = Float64(c * i); elseif (z <= 1.15e-279) tmp = Float64(x * y); elseif (z <= 3800000.0) tmp = Float64(a * b); else tmp = Float64(z * t); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if (z <= -4.3e+98)
tmp = z * t;
elseif (z <= -3.6e+14)
tmp = c * i;
elseif (z <= -1.9e-67)
tmp = x * y;
elseif (z <= -1.12e-194)
tmp = c * i;
elseif (z <= 1.15e-279)
tmp = x * y;
elseif (z <= 3800000.0)
tmp = a * b;
else
tmp = z * t;
end
tmp_2 = tmp;
end
NOTE: c and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -4.3e+98], N[(z * t), $MachinePrecision], If[LessEqual[z, -3.6e+14], N[(c * i), $MachinePrecision], If[LessEqual[z, -1.9e-67], N[(x * y), $MachinePrecision], If[LessEqual[z, -1.12e-194], N[(c * i), $MachinePrecision], If[LessEqual[z, 1.15e-279], N[(x * y), $MachinePrecision], If[LessEqual[z, 3800000.0], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]]]]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+98}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{+14}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-67}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \leq -1.12 \cdot 10^{-194}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-279}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \leq 3800000:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if z < -4.3000000000000001e98 or 3.8e6 < z Initial program 95.4%
Taylor expanded in z around inf 52.7%
if -4.3000000000000001e98 < z < -3.6e14 or -1.89999999999999994e-67 < z < -1.12000000000000001e-194Initial program 95.9%
Taylor expanded in c around inf 36.3%
if -3.6e14 < z < -1.89999999999999994e-67 or -1.12000000000000001e-194 < z < 1.14999999999999998e-279Initial program 100.0%
Taylor expanded in x around inf 41.6%
if 1.14999999999999998e-279 < z < 3.8e6Initial program 93.0%
Taylor expanded in a around inf 29.7%
Final simplification42.7%
NOTE: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -1.45e+52) (not (<= (* c i) 48000000.0))) (+ (* c i) (* a b)) (+ (* a b) (* z t))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -1.45e+52) || !((c * i) <= 48000000.0)) {
tmp = (c * i) + (a * b);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
NOTE: c and i 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) <= (-1.45d+52)) .or. (.not. ((c * i) <= 48000000.0d0))) then
tmp = (c * i) + (a * b)
else
tmp = (a * b) + (z * t)
end if
code = tmp
end function
assert c < i;
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) <= -1.45e+52) || !((c * i) <= 48000000.0)) {
tmp = (c * i) + (a * b);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -1.45e+52) or not ((c * i) <= 48000000.0): tmp = (c * i) + (a * b) else: tmp = (a * b) + (z * t) return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -1.45e+52) || !(Float64(c * i) <= 48000000.0)) tmp = Float64(Float64(c * i) + Float64(a * b)); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if (((c * i) <= -1.45e+52) || ~(((c * i) <= 48000000.0)))
tmp = (c * i) + (a * b);
else
tmp = (a * b) + (z * t);
end
tmp_2 = tmp;
end
NOTE: c and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -1.45e+52], N[Not[LessEqual[N[(c * i), $MachinePrecision], 48000000.0]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.45 \cdot 10^{+52} \lor \neg \left(c \cdot i \leq 48000000\right):\\
\;\;\;\;c \cdot i + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 c i) < -1.45e52 or 4.8e7 < (*.f64 c i) Initial program 91.5%
Taylor expanded in x around 0 81.4%
Taylor expanded in t around 0 71.5%
if -1.45e52 < (*.f64 c i) < 4.8e7Initial program 99.3%
Taylor expanded in c around 0 95.8%
Taylor expanded in y around 0 67.5%
Final simplification69.3%
NOTE: c and i 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.3e+221) (* c i) (if (<= (* c i) 3.5e+82) (+ (* a b) (* z t)) (* c i))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -3.3e+221) {
tmp = c * i;
} else if ((c * i) <= 3.5e+82) {
tmp = (a * b) + (z * t);
} else {
tmp = c * i;
}
return tmp;
}
NOTE: c and i 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.3d+221)) then
tmp = c * i
else if ((c * i) <= 3.5d+82) then
tmp = (a * b) + (z * t)
else
tmp = c * i
end if
code = tmp
end function
assert c < i;
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.3e+221) {
tmp = c * i;
} else if ((c * i) <= 3.5e+82) {
tmp = (a * b) + (z * t);
} else {
tmp = c * i;
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -3.3e+221: tmp = c * i elif (c * i) <= 3.5e+82: tmp = (a * b) + (z * t) else: tmp = c * i return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -3.3e+221) tmp = Float64(c * i); elseif (Float64(c * i) <= 3.5e+82) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(c * i); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((c * i) <= -3.3e+221)
tmp = c * i;
elseif ((c * i) <= 3.5e+82)
tmp = (a * b) + (z * t);
else
tmp = c * i;
end
tmp_2 = tmp;
end
NOTE: c and i 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.3e+221], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 3.5e+82], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(c * i), $MachinePrecision]]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.3 \cdot 10^{+221}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 3.5 \cdot 10^{+82}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -3.29999999999999991e221 or 3.5e82 < (*.f64 c i) Initial program 87.1%
Taylor expanded in c around inf 68.9%
if -3.29999999999999991e221 < (*.f64 c i) < 3.5e82Initial program 98.9%
Taylor expanded in c around 0 88.6%
Taylor expanded in y around 0 61.6%
Final simplification63.6%
NOTE: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= z -9.2e+14) (not (<= z 15000000.0))) (+ (* a b) (* z t)) (+ (* a b) (* x y))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z <= -9.2e+14) || !(z <= 15000000.0)) {
tmp = (a * b) + (z * t);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
NOTE: c and i 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 ((z <= (-9.2d+14)) .or. (.not. (z <= 15000000.0d0))) then
tmp = (a * b) + (z * t)
else
tmp = (a * b) + (x * y)
end if
code = tmp
end function
assert c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z <= -9.2e+14) || !(z <= 15000000.0)) {
tmp = (a * b) + (z * t);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (z <= -9.2e+14) or not (z <= 15000000.0): tmp = (a * b) + (z * t) else: tmp = (a * b) + (x * y) return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((z <= -9.2e+14) || !(z <= 15000000.0)) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(Float64(a * b) + Float64(x * y)); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((z <= -9.2e+14) || ~((z <= 15000000.0)))
tmp = (a * b) + (z * t);
else
tmp = (a * b) + (x * y);
end
tmp_2 = tmp;
end
NOTE: c and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[z, -9.2e+14], N[Not[LessEqual[z, 15000000.0]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+14} \lor \neg \left(z \leq 15000000\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\end{array}
if z < -9.2e14 or 1.5e7 < z Initial program 95.2%
Taylor expanded in c around 0 77.6%
Taylor expanded in y around 0 65.8%
if -9.2e14 < z < 1.5e7Initial program 96.2%
Taylor expanded in c around 0 71.6%
Taylor expanded in t around 0 64.9%
Final simplification65.4%
NOTE: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -4.7e+153) (* a b) (if (<= (* a b) 1.05e+41) (* c i) (* a b))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -4.7e+153) {
tmp = a * b;
} else if ((a * b) <= 1.05e+41) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
NOTE: c and i 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) <= (-4.7d+153)) then
tmp = a * b
else if ((a * b) <= 1.05d+41) then
tmp = c * i
else
tmp = a * b
end if
code = tmp
end function
assert c < i;
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) <= -4.7e+153) {
tmp = a * b;
} else if ((a * b) <= 1.05e+41) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -4.7e+153: tmp = a * b elif (a * b) <= 1.05e+41: tmp = c * i else: tmp = a * b return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -4.7e+153) tmp = Float64(a * b); elseif (Float64(a * b) <= 1.05e+41) tmp = Float64(c * i); else tmp = Float64(a * b); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((a * b) <= -4.7e+153)
tmp = a * b;
elseif ((a * b) <= 1.05e+41)
tmp = c * i;
else
tmp = a * b;
end
tmp_2 = tmp;
end
NOTE: c and i 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], -4.7e+153], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.05e+41], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.7 \cdot 10^{+153}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.05 \cdot 10^{+41}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -4.69999999999999968e153 or 1.05e41 < (*.f64 a b) Initial program 93.2%
Taylor expanded in a around inf 63.4%
if -4.69999999999999968e153 < (*.f64 a b) < 1.05e41Initial program 97.0%
Taylor expanded in c around inf 37.7%
Final simplification46.7%
NOTE: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= z -4.3e+98) (* z t) (if (<= z 2.3e-228) (* c i) (if (<= z 6800000.0) (* a b) (* z t)))))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (z <= -4.3e+98) {
tmp = z * t;
} else if (z <= 2.3e-228) {
tmp = c * i;
} else if (z <= 6800000.0) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
NOTE: c and i 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 (z <= (-4.3d+98)) then
tmp = z * t
else if (z <= 2.3d-228) then
tmp = c * i
else if (z <= 6800000.0d0) then
tmp = a * b
else
tmp = z * t
end if
code = tmp
end function
assert c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (z <= -4.3e+98) {
tmp = z * t;
} else if (z <= 2.3e-228) {
tmp = c * i;
} else if (z <= 6800000.0) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if z <= -4.3e+98: tmp = z * t elif z <= 2.3e-228: tmp = c * i elif z <= 6800000.0: tmp = a * b else: tmp = z * t return tmp
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (z <= -4.3e+98) tmp = Float64(z * t); elseif (z <= 2.3e-228) tmp = Float64(c * i); elseif (z <= 6800000.0) tmp = Float64(a * b); else tmp = Float64(z * t); end return tmp end
c, i = num2cell(sort([c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if (z <= -4.3e+98)
tmp = z * t;
elseif (z <= 2.3e-228)
tmp = c * i;
elseif (z <= 6800000.0)
tmp = a * b;
else
tmp = z * t;
end
tmp_2 = tmp;
end
NOTE: c and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -4.3e+98], N[(z * t), $MachinePrecision], If[LessEqual[z, 2.3e-228], N[(c * i), $MachinePrecision], If[LessEqual[z, 6800000.0], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]]
\begin{array}{l}
[c, i] = \mathsf{sort}([c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+98}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-228}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;z \leq 6800000:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if z < -4.3000000000000001e98 or 6.8e6 < z Initial program 95.4%
Taylor expanded in z around inf 52.7%
if -4.3000000000000001e98 < z < 2.2999999999999999e-228Initial program 98.0%
Taylor expanded in c around inf 32.0%
if 2.2999999999999999e-228 < z < 6.8e6Initial program 91.1%
Taylor expanded in a around inf 32.5%
Final simplification40.9%
NOTE: c and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (* a b))
assert(c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
NOTE: c and i 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 c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
[c, i] = sort([c, i]) def code(x, y, z, t, a, b, c, i): return a * b
c, i = sort([c, i]) function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
c, i = num2cell(sort([c, i])){:}
function tmp = code(x, y, z, t, a, b, c, i)
tmp = a * b;
end
NOTE: c and i 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}
[c, i] = \mathsf{sort}([c, i])\\
\\
a \cdot b
\end{array}
Initial program 95.7%
Taylor expanded in a around inf 27.7%
Final simplification27.7%
herbie shell --seed 2023274
(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)))