
(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}
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1e+228) (fma a b (* c i)) (fma c i (fma a b (fma x y (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1e+228) {
tmp = fma(a, b, (c * i));
} else {
tmp = fma(c, i, fma(a, b, fma(x, y, (z * t))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1e+228) tmp = fma(a, b, Float64(c * i)); else tmp = fma(c, i, fma(a, b, fma(x, y, Float64(z * t)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e+228], N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(c * i + N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+228}:\\
\;\;\;\;\mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -9.9999999999999992e227Initial program 74.9%
Taylor expanded in z around 0 78.5%
Taylor expanded in x around 0 92.8%
fma-def96.4%
Simplified96.4%
if -9.9999999999999992e227 < (*.f64 a b) Initial program 96.5%
+-commutative96.5%
fma-def97.8%
+-commutative97.8%
fma-def98.7%
fma-def98.7%
Simplified98.7%
Final simplification98.4%
(FPCore (x y z t a b c i) :precision binary64 (fma c i (fma x y (fma z t (* a b)))))
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))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))) end
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}
\\
\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-def95.3%
associate-+l+95.3%
fma-def97.3%
fma-def98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (+ (* c i) (+ (* a b) (+ (* x y) (* z t)))) INFINITY) (+ (* x y) (+ (fma a b (* c i)) (* z t))) (* a b)))
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) + ((x * y) + (z * t)))) <= ((double) INFINITY)) {
tmp = (x * y) + (fma(a, b, (c * i)) + (z * t));
} else {
tmp = a * b;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t)))) <= Inf) tmp = Float64(Float64(x * y) + Float64(fma(a, b, Float64(c * i)) + Float64(z * t))); else tmp = Float64(a * b); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x * y), $MachinePrecision] + N[(N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) \leq \infty:\\
\;\;\;\;x \cdot y + \left(\mathsf{fma}\left(a, b, c \cdot i\right) + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\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%
+-commutative100.0%
fma-def100.0%
fma-def100.0%
Simplified100.0%
fma-udef100.0%
fma-udef100.0%
associate-+r+100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
associate-+r+100.0%
fma-def100.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%
+-commutative0.0%
fma-def20.0%
+-commutative20.0%
fma-def40.0%
fma-def40.0%
Simplified40.0%
fma-udef20.0%
fma-def20.0%
associate-+r+20.0%
Applied egg-rr20.0%
Taylor expanded in z around 0 33.3%
Taylor expanded in a around inf 53.8%
Final simplification97.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (+ (* a b) (+ (* x y) (* z t))) INFINITY) (fma c i (+ (+ (* a b) (* x y)) (* z t))) (* a b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) + ((x * y) + (z * t))) <= ((double) INFINITY)) {
tmp = fma(c, i, (((a * b) + (x * y)) + (z * t)));
} else {
tmp = a * b;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) <= Inf) tmp = fma(c, i, Float64(Float64(Float64(a * b) + Float64(x * y)) + Float64(z * t))); else tmp = Float64(a * b); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(c * i + N[(N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b + \left(x \cdot y + z \cdot t\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(c, i, \left(a \cdot b + x \cdot y\right) + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 98.3%
+-commutative98.3%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
fma-def99.6%
Simplified99.6%
fma-udef99.6%
fma-def99.6%
associate-+r+99.6%
Applied egg-rr99.6%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
+-commutative0.0%
fma-def0.0%
+-commutative0.0%
fma-def27.3%
fma-def27.3%
Simplified27.3%
fma-udef0.0%
fma-def0.0%
associate-+r+0.0%
Applied egg-rr0.0%
Taylor expanded in z around 0 27.3%
Taylor expanded in a around inf 63.9%
Final simplification98.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))) (t_2 (+ (* a b) (* c i))))
(if (<= (* a b) -7e+155)
t_2
(if (<= (* a b) -7e-85)
t_1
(if (<= (* a b) 9e-163)
(+ (* c i) (* z t))
(if (or (<= (* a b) 2.2e+45)
(and (not (<= (* a b) 5.5e+62)) (<= (* a b) 1.45e+140)))
t_1
t_2))))))
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 = (a * b) + (c * i);
double tmp;
if ((a * b) <= -7e+155) {
tmp = t_2;
} else if ((a * b) <= -7e-85) {
tmp = t_1;
} else if ((a * b) <= 9e-163) {
tmp = (c * i) + (z * t);
} else if (((a * b) <= 2.2e+45) || (!((a * b) <= 5.5e+62) && ((a * b) <= 1.45e+140))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
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 = (a * b) + (c * i)
if ((a * b) <= (-7d+155)) then
tmp = t_2
else if ((a * b) <= (-7d-85)) then
tmp = t_1
else if ((a * b) <= 9d-163) then
tmp = (c * i) + (z * t)
else if (((a * b) <= 2.2d+45) .or. (.not. ((a * b) <= 5.5d+62)) .and. ((a * b) <= 1.45d+140)) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
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 = (a * b) + (c * i);
double tmp;
if ((a * b) <= -7e+155) {
tmp = t_2;
} else if ((a * b) <= -7e-85) {
tmp = t_1;
} else if ((a * b) <= 9e-163) {
tmp = (c * i) + (z * t);
} else if (((a * b) <= 2.2e+45) || (!((a * b) <= 5.5e+62) && ((a * b) <= 1.45e+140))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) t_2 = (a * b) + (c * i) tmp = 0 if (a * b) <= -7e+155: tmp = t_2 elif (a * b) <= -7e-85: tmp = t_1 elif (a * b) <= 9e-163: tmp = (c * i) + (z * t) elif ((a * b) <= 2.2e+45) or (not ((a * b) <= 5.5e+62) and ((a * b) <= 1.45e+140)): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) t_2 = Float64(Float64(a * b) + Float64(c * i)) tmp = 0.0 if (Float64(a * b) <= -7e+155) tmp = t_2; elseif (Float64(a * b) <= -7e-85) tmp = t_1; elseif (Float64(a * b) <= 9e-163) tmp = Float64(Float64(c * i) + Float64(z * t)); elseif ((Float64(a * b) <= 2.2e+45) || (!(Float64(a * b) <= 5.5e+62) && (Float64(a * b) <= 1.45e+140))) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (x * y) + (z * t); t_2 = (a * b) + (c * i); tmp = 0.0; if ((a * b) <= -7e+155) tmp = t_2; elseif ((a * b) <= -7e-85) tmp = t_1; elseif ((a * b) <= 9e-163) tmp = (c * i) + (z * t); elseif (((a * b) <= 2.2e+45) || (~(((a * b) <= 5.5e+62)) && ((a * b) <= 1.45e+140))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
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[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -7e+155], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -7e-85], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 9e-163], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], 2.2e+45], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], 5.5e+62]], $MachinePrecision], LessEqual[N[(a * b), $MachinePrecision], 1.45e+140]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := a \cdot b + c \cdot i\\
\mathbf{if}\;a \cdot b \leq -7 \cdot 10^{+155}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq -7 \cdot 10^{-85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 9 \cdot 10^{-163}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 2.2 \cdot 10^{+45} \lor \neg \left(a \cdot b \leq 5.5 \cdot 10^{+62}\right) \land a \cdot b \leq 1.45 \cdot 10^{+140}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (*.f64 a b) < -6.99999999999999969e155 or 2.2e45 < (*.f64 a b) < 5.4999999999999997e62 or 1.4499999999999999e140 < (*.f64 a b) Initial program 87.1%
Taylor expanded in a around inf 87.2%
if -6.99999999999999969e155 < (*.f64 a b) < -6.99999999999999956e-85 or 8.9999999999999995e-163 < (*.f64 a b) < 2.2e45 or 5.4999999999999997e62 < (*.f64 a b) < 1.4499999999999999e140Initial program 97.9%
Taylor expanded in a around 0 84.9%
Taylor expanded in c around 0 71.5%
if -6.99999999999999956e-85 < (*.f64 a b) < 8.9999999999999995e-163Initial program 98.5%
Taylor expanded in z around inf 71.2%
Final simplification77.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))) (t_2 (+ (* a b) (* c i))))
(if (<= (* a b) -1.05e+157)
t_2
(if (<= (* a b) -7.8e-38)
t_1
(if (<= (* a b) 3.6e-257)
(+ (* c i) (* x y))
(if (or (<= (* a b) 1.6e+45)
(and (not (<= (* a b) 2.4e+63)) (<= (* a b) 1.12e+144)))
t_1
t_2))))))
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 = (a * b) + (c * i);
double tmp;
if ((a * b) <= -1.05e+157) {
tmp = t_2;
} else if ((a * b) <= -7.8e-38) {
tmp = t_1;
} else if ((a * b) <= 3.6e-257) {
tmp = (c * i) + (x * y);
} else if (((a * b) <= 1.6e+45) || (!((a * b) <= 2.4e+63) && ((a * b) <= 1.12e+144))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
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 = (a * b) + (c * i)
if ((a * b) <= (-1.05d+157)) then
tmp = t_2
else if ((a * b) <= (-7.8d-38)) then
tmp = t_1
else if ((a * b) <= 3.6d-257) then
tmp = (c * i) + (x * y)
else if (((a * b) <= 1.6d+45) .or. (.not. ((a * b) <= 2.4d+63)) .and. ((a * b) <= 1.12d+144)) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
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 = (a * b) + (c * i);
double tmp;
if ((a * b) <= -1.05e+157) {
tmp = t_2;
} else if ((a * b) <= -7.8e-38) {
tmp = t_1;
} else if ((a * b) <= 3.6e-257) {
tmp = (c * i) + (x * y);
} else if (((a * b) <= 1.6e+45) || (!((a * b) <= 2.4e+63) && ((a * b) <= 1.12e+144))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) t_2 = (a * b) + (c * i) tmp = 0 if (a * b) <= -1.05e+157: tmp = t_2 elif (a * b) <= -7.8e-38: tmp = t_1 elif (a * b) <= 3.6e-257: tmp = (c * i) + (x * y) elif ((a * b) <= 1.6e+45) or (not ((a * b) <= 2.4e+63) and ((a * b) <= 1.12e+144)): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) t_2 = Float64(Float64(a * b) + Float64(c * i)) tmp = 0.0 if (Float64(a * b) <= -1.05e+157) tmp = t_2; elseif (Float64(a * b) <= -7.8e-38) tmp = t_1; elseif (Float64(a * b) <= 3.6e-257) tmp = Float64(Float64(c * i) + Float64(x * y)); elseif ((Float64(a * b) <= 1.6e+45) || (!(Float64(a * b) <= 2.4e+63) && (Float64(a * b) <= 1.12e+144))) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (x * y) + (z * t); t_2 = (a * b) + (c * i); tmp = 0.0; if ((a * b) <= -1.05e+157) tmp = t_2; elseif ((a * b) <= -7.8e-38) tmp = t_1; elseif ((a * b) <= 3.6e-257) tmp = (c * i) + (x * y); elseif (((a * b) <= 1.6e+45) || (~(((a * b) <= 2.4e+63)) && ((a * b) <= 1.12e+144))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
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[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1.05e+157], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -7.8e-38], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 3.6e-257], N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], 1.6e+45], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.4e+63]], $MachinePrecision], LessEqual[N[(a * b), $MachinePrecision], 1.12e+144]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := a \cdot b + c \cdot i\\
\mathbf{if}\;a \cdot b \leq -1.05 \cdot 10^{+157}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq -7.8 \cdot 10^{-38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 3.6 \cdot 10^{-257}:\\
\;\;\;\;c \cdot i + x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{+45} \lor \neg \left(a \cdot b \leq 2.4 \cdot 10^{+63}\right) \land a \cdot b \leq 1.12 \cdot 10^{+144}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (*.f64 a b) < -1.05e157 or 1.6000000000000001e45 < (*.f64 a b) < 2.4e63 or 1.11999999999999999e144 < (*.f64 a b) Initial program 87.1%
Taylor expanded in a around inf 87.2%
if -1.05e157 < (*.f64 a b) < -7.7999999999999998e-38 or 3.60000000000000007e-257 < (*.f64 a b) < 1.6000000000000001e45 or 2.4e63 < (*.f64 a b) < 1.11999999999999999e144Initial program 98.0%
Taylor expanded in a around 0 87.4%
Taylor expanded in c around 0 72.6%
if -7.7999999999999998e-38 < (*.f64 a b) < 3.60000000000000007e-257Initial program 98.4%
Taylor expanded in x around inf 71.8%
Final simplification77.7%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -5e+155)
(* a b)
(if (<= (* a b) -1.15e-35)
(* z t)
(if (<= (* a b) 5.5e-170)
(* c i)
(if (<= (* a b) 9e+35)
(* x y)
(if (<= (* a b) 5.4e+161) (* z t) (* a b)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -5e+155) {
tmp = a * b;
} else if ((a * b) <= -1.15e-35) {
tmp = z * t;
} else if ((a * b) <= 5.5e-170) {
tmp = c * i;
} else if ((a * b) <= 9e+35) {
tmp = x * y;
} else if ((a * b) <= 5.4e+161) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
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) <= (-5d+155)) then
tmp = a * b
else if ((a * b) <= (-1.15d-35)) then
tmp = z * t
else if ((a * b) <= 5.5d-170) then
tmp = c * i
else if ((a * b) <= 9d+35) then
tmp = x * y
else if ((a * b) <= 5.4d+161) then
tmp = z * t
else
tmp = a * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -5e+155) {
tmp = a * b;
} else if ((a * b) <= -1.15e-35) {
tmp = z * t;
} else if ((a * b) <= 5.5e-170) {
tmp = c * i;
} else if ((a * b) <= 9e+35) {
tmp = x * y;
} else if ((a * b) <= 5.4e+161) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -5e+155: tmp = a * b elif (a * b) <= -1.15e-35: tmp = z * t elif (a * b) <= 5.5e-170: tmp = c * i elif (a * b) <= 9e+35: tmp = x * y elif (a * b) <= 5.4e+161: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -5e+155) tmp = Float64(a * b); elseif (Float64(a * b) <= -1.15e-35) tmp = Float64(z * t); elseif (Float64(a * b) <= 5.5e-170) tmp = Float64(c * i); elseif (Float64(a * b) <= 9e+35) tmp = Float64(x * y); elseif (Float64(a * b) <= 5.4e+161) tmp = Float64(z * t); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -5e+155) tmp = a * b; elseif ((a * b) <= -1.15e-35) tmp = z * t; elseif ((a * b) <= 5.5e-170) tmp = c * i; elseif ((a * b) <= 9e+35) tmp = x * y; elseif ((a * b) <= 5.4e+161) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -5e+155], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.15e-35], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.5e-170], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 9e+35], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.4e+161], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+155}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.15 \cdot 10^{-35}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 5.5 \cdot 10^{-170}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 9 \cdot 10^{+35}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 5.4 \cdot 10^{+161}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -4.9999999999999999e155 or 5.3999999999999995e161 < (*.f64 a b) Initial program 86.0%
+-commutative86.0%
fma-def87.2%
+-commutative87.2%
fma-def90.7%
fma-def90.7%
Simplified90.7%
fma-udef87.2%
fma-def87.2%
associate-+r+87.2%
Applied egg-rr87.2%
Taylor expanded in z around 0 86.2%
Taylor expanded in a around inf 75.9%
if -4.9999999999999999e155 < (*.f64 a b) < -1.1499999999999999e-35 or 8.9999999999999993e35 < (*.f64 a b) < 5.3999999999999995e161Initial program 95.7%
Taylor expanded in a around 0 78.1%
Taylor expanded in t around inf 49.0%
if -1.1499999999999999e-35 < (*.f64 a b) < 5.50000000000000018e-170Initial program 98.7%
Taylor expanded in c around inf 38.7%
if 5.50000000000000018e-170 < (*.f64 a b) < 8.9999999999999993e35Initial program 100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
fma-def100.0%
fma-def100.0%
Simplified100.0%
fma-udef100.0%
fma-def100.0%
associate-+r+100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 73.6%
Taylor expanded in x around inf 44.0%
Final simplification54.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* c i) (* z t))) (t_2 (+ (* a b) (* c i))))
(if (<= (* a b) -1.15e+157)
t_2
(if (<= (* a b) 480000000000.0)
t_1
(if (<= (* a b) 3.5e+32)
(+ (* a b) (* x y))
(if (<= (* a b) 5e+140) t_1 t_2))))))
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) + (c * i);
double tmp;
if ((a * b) <= -1.15e+157) {
tmp = t_2;
} else if ((a * b) <= 480000000000.0) {
tmp = t_1;
} else if ((a * b) <= 3.5e+32) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 5e+140) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
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 = (c * i) + (z * t)
t_2 = (a * b) + (c * i)
if ((a * b) <= (-1.15d+157)) then
tmp = t_2
else if ((a * b) <= 480000000000.0d0) then
tmp = t_1
else if ((a * b) <= 3.5d+32) then
tmp = (a * b) + (x * y)
else if ((a * b) <= 5d+140) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
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) + (c * i);
double tmp;
if ((a * b) <= -1.15e+157) {
tmp = t_2;
} else if ((a * b) <= 480000000000.0) {
tmp = t_1;
} else if ((a * b) <= 3.5e+32) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 5e+140) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + (z * t) t_2 = (a * b) + (c * i) tmp = 0 if (a * b) <= -1.15e+157: tmp = t_2 elif (a * b) <= 480000000000.0: tmp = t_1 elif (a * b) <= 3.5e+32: tmp = (a * b) + (x * y) elif (a * b) <= 5e+140: tmp = t_1 else: tmp = t_2 return tmp
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(c * i)) tmp = 0.0 if (Float64(a * b) <= -1.15e+157) tmp = t_2; elseif (Float64(a * b) <= 480000000000.0) tmp = t_1; elseif (Float64(a * b) <= 3.5e+32) tmp = Float64(Float64(a * b) + Float64(x * y)); elseif (Float64(a * b) <= 5e+140) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (c * i) + (z * t); t_2 = (a * b) + (c * i); tmp = 0.0; if ((a * b) <= -1.15e+157) tmp = t_2; elseif ((a * b) <= 480000000000.0) tmp = t_1; elseif ((a * b) <= 3.5e+32) tmp = (a * b) + (x * y); elseif ((a * b) <= 5e+140) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
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[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1.15e+157], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 480000000000.0], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 3.5e+32], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+140], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
t_2 := a \cdot b + c \cdot i\\
\mathbf{if}\;a \cdot b \leq -1.15 \cdot 10^{+157}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 480000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 3.5 \cdot 10^{+32}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+140}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (*.f64 a b) < -1.15000000000000002e157 or 5.00000000000000008e140 < (*.f64 a b) Initial program 86.3%
Taylor expanded in a around inf 86.4%
if -1.15000000000000002e157 < (*.f64 a b) < 4.8e11 or 3.5000000000000001e32 < (*.f64 a b) < 5.00000000000000008e140Initial program 98.1%
Taylor expanded in z around inf 62.0%
if 4.8e11 < (*.f64 a b) < 3.5000000000000001e32Initial program 100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
fma-def100.0%
fma-def100.0%
Simplified100.0%
fma-udef100.0%
fma-def100.0%
associate-+r+100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 81.8%
Taylor expanded in c around 0 72.8%
Final simplification70.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= (+ (* c i) (+ (* a b) t_1)) INFINITY)
(+ (+ (* a b) (* c i)) t_1)
(* a b))))
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 (((c * i) + ((a * b) + t_1)) <= ((double) INFINITY)) {
tmp = ((a * b) + (c * i)) + t_1;
} else {
tmp = a * b;
}
return tmp;
}
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 (((c * i) + ((a * b) + t_1)) <= Double.POSITIVE_INFINITY) {
tmp = ((a * b) + (c * i)) + t_1;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if ((c * i) + ((a * b) + t_1)) <= math.inf: tmp = ((a * b) + (c * i)) + t_1 else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (Float64(Float64(c * i) + Float64(Float64(a * b) + t_1)) <= Inf) tmp = Float64(Float64(Float64(a * b) + Float64(c * i)) + t_1); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (x * y) + (z * t); tmp = 0.0; if (((c * i) + ((a * b) + t_1)) <= Inf) tmp = ((a * b) + (c * i)) + t_1; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;c \cdot i + \left(a \cdot b + t_1\right) \leq \infty:\\
\;\;\;\;\left(a \cdot b + c \cdot i\right) + t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\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%
associate-+l+100.0%
fma-def100.0%
Simplified100.0%
fma-def100.0%
+-commutative100.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%
+-commutative0.0%
fma-def20.0%
+-commutative20.0%
fma-def40.0%
fma-def40.0%
Simplified40.0%
fma-udef20.0%
fma-def20.0%
associate-+r+20.0%
Applied egg-rr20.0%
Taylor expanded in z around 0 33.3%
Taylor expanded in a around inf 53.8%
Final simplification97.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -6e+155)
(* a b)
(if (<= (* a b) -3.1e-39)
(* z t)
(if (<= (* a b) 1.26e-256)
(* c i)
(if (<= (* a b) 8.4e+161) (* z t) (* a b))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -6e+155) {
tmp = a * b;
} else if ((a * b) <= -3.1e-39) {
tmp = z * t;
} else if ((a * b) <= 1.26e-256) {
tmp = c * i;
} else if ((a * b) <= 8.4e+161) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
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) <= (-6d+155)) then
tmp = a * b
else if ((a * b) <= (-3.1d-39)) then
tmp = z * t
else if ((a * b) <= 1.26d-256) then
tmp = c * i
else if ((a * b) <= 8.4d+161) then
tmp = z * t
else
tmp = a * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -6e+155) {
tmp = a * b;
} else if ((a * b) <= -3.1e-39) {
tmp = z * t;
} else if ((a * b) <= 1.26e-256) {
tmp = c * i;
} else if ((a * b) <= 8.4e+161) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -6e+155: tmp = a * b elif (a * b) <= -3.1e-39: tmp = z * t elif (a * b) <= 1.26e-256: tmp = c * i elif (a * b) <= 8.4e+161: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -6e+155) tmp = Float64(a * b); elseif (Float64(a * b) <= -3.1e-39) tmp = Float64(z * t); elseif (Float64(a * b) <= 1.26e-256) tmp = Float64(c * i); elseif (Float64(a * b) <= 8.4e+161) tmp = Float64(z * t); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -6e+155) tmp = a * b; elseif ((a * b) <= -3.1e-39) tmp = z * t; elseif ((a * b) <= 1.26e-256) tmp = c * i; elseif ((a * b) <= 8.4e+161) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -6e+155], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -3.1e-39], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.26e-256], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8.4e+161], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6 \cdot 10^{+155}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -3.1 \cdot 10^{-39}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.26 \cdot 10^{-256}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 8.4 \cdot 10^{+161}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -6.0000000000000003e155 or 8.4e161 < (*.f64 a b) Initial program 86.0%
+-commutative86.0%
fma-def87.2%
+-commutative87.2%
fma-def90.7%
fma-def90.7%
Simplified90.7%
fma-udef87.2%
fma-def87.2%
associate-+r+87.2%
Applied egg-rr87.2%
Taylor expanded in z around 0 86.2%
Taylor expanded in a around inf 75.9%
if -6.0000000000000003e155 < (*.f64 a b) < -3.0999999999999997e-39 or 1.25999999999999999e-256 < (*.f64 a b) < 8.4e161Initial program 98.1%
Taylor expanded in a around 0 85.6%
Taylor expanded in t around inf 39.9%
if -3.0999999999999997e-39 < (*.f64 a b) < 1.25999999999999999e-256Initial program 98.4%
Taylor expanded in c around inf 40.3%
Final simplification52.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* a b) (* x y))) (t_2 (+ (* a b) (* c i))))
(if (<= i -2.5e-12)
t_2
(if (<= i 3.6e-69)
t_1
(if (<= i 6.8e-17) (* z t) (if (<= i 1.42e+156) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (a * b) + (x * y);
double t_2 = (a * b) + (c * i);
double tmp;
if (i <= -2.5e-12) {
tmp = t_2;
} else if (i <= 3.6e-69) {
tmp = t_1;
} else if (i <= 6.8e-17) {
tmp = z * t;
} else if (i <= 1.42e+156) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
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 = (a * b) + (x * y)
t_2 = (a * b) + (c * i)
if (i <= (-2.5d-12)) then
tmp = t_2
else if (i <= 3.6d-69) then
tmp = t_1
else if (i <= 6.8d-17) then
tmp = z * t
else if (i <= 1.42d+156) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (a * b) + (x * y);
double t_2 = (a * b) + (c * i);
double tmp;
if (i <= -2.5e-12) {
tmp = t_2;
} else if (i <= 3.6e-69) {
tmp = t_1;
} else if (i <= 6.8e-17) {
tmp = z * t;
} else if (i <= 1.42e+156) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (a * b) + (x * y) t_2 = (a * b) + (c * i) tmp = 0 if i <= -2.5e-12: tmp = t_2 elif i <= 3.6e-69: tmp = t_1 elif i <= 6.8e-17: tmp = z * t elif i <= 1.42e+156: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(a * b) + Float64(x * y)) t_2 = Float64(Float64(a * b) + Float64(c * i)) tmp = 0.0 if (i <= -2.5e-12) tmp = t_2; elseif (i <= 3.6e-69) tmp = t_1; elseif (i <= 6.8e-17) tmp = Float64(z * t); elseif (i <= 1.42e+156) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (a * b) + (x * y); t_2 = (a * b) + (c * i); tmp = 0.0; if (i <= -2.5e-12) tmp = t_2; elseif (i <= 3.6e-69) tmp = t_1; elseif (i <= 6.8e-17) tmp = z * t; elseif (i <= 1.42e+156) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -2.5e-12], t$95$2, If[LessEqual[i, 3.6e-69], t$95$1, If[LessEqual[i, 6.8e-17], N[(z * t), $MachinePrecision], If[LessEqual[i, 1.42e+156], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
t_2 := a \cdot b + c \cdot i\\
\mathbf{if}\;i \leq -2.5 \cdot 10^{-12}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 3.6 \cdot 10^{-69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq 6.8 \cdot 10^{-17}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;i \leq 1.42 \cdot 10^{+156}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if i < -2.49999999999999985e-12 or 1.41999999999999998e156 < i Initial program 91.0%
Taylor expanded in a around inf 69.7%
if -2.49999999999999985e-12 < i < 3.60000000000000018e-69 or 6.7999999999999996e-17 < i < 1.41999999999999998e156Initial program 95.8%
+-commutative95.8%
fma-def95.9%
+-commutative95.9%
fma-def97.2%
fma-def97.2%
Simplified97.2%
fma-udef95.9%
fma-def95.9%
associate-+r+95.9%
Applied egg-rr95.9%
Taylor expanded in z around 0 74.6%
Taylor expanded in c around 0 64.1%
if 3.60000000000000018e-69 < i < 6.7999999999999996e-17Initial program 100.0%
Taylor expanded in a around 0 73.6%
Taylor expanded in t around inf 42.7%
Final simplification65.4%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -5.6e+157)
(+ (* a b) (* c i))
(if (<= (* a b) 1.75e+147)
(+ (* c i) (+ (* x y) (* z t)))
(+ (* c i) (+ (* a b) (* 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) <= -5.6e+157) {
tmp = (a * b) + (c * i);
} else if ((a * b) <= 1.75e+147) {
tmp = (c * i) + ((x * y) + (z * t));
} else {
tmp = (c * i) + ((a * b) + (x * y));
}
return tmp;
}
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) <= (-5.6d+157)) then
tmp = (a * b) + (c * i)
else if ((a * b) <= 1.75d+147) then
tmp = (c * i) + ((x * y) + (z * t))
else
tmp = (c * i) + ((a * b) + (x * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -5.6e+157) {
tmp = (a * b) + (c * i);
} else if ((a * b) <= 1.75e+147) {
tmp = (c * i) + ((x * y) + (z * t));
} else {
tmp = (c * i) + ((a * b) + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -5.6e+157: tmp = (a * b) + (c * i) elif (a * b) <= 1.75e+147: tmp = (c * i) + ((x * y) + (z * t)) else: tmp = (c * i) + ((a * b) + (x * y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -5.6e+157) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(a * b) <= 1.75e+147) tmp = Float64(Float64(c * i) + Float64(Float64(x * y) + Float64(z * t))); else tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -5.6e+157) tmp = (a * b) + (c * i); elseif ((a * b) <= 1.75e+147) tmp = (c * i) + ((x * y) + (z * t)); else tmp = (c * i) + ((a * b) + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -5.6e+157], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.75e+147], N[(N[(c * i), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5.6 \cdot 10^{+157}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 1.75 \cdot 10^{+147}:\\
\;\;\;\;c \cdot i + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -5.6000000000000005e157Initial program 83.7%
Taylor expanded in a around inf 90.8%
if -5.6000000000000005e157 < (*.f64 a b) < 1.74999999999999987e147Initial program 98.2%
Taylor expanded in a around 0 89.0%
if 1.74999999999999987e147 < (*.f64 a b) Initial program 88.9%
Taylor expanded in z around 0 86.8%
Final simplification88.9%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -7.2e+175) (not (<= (* x y) 3e+133))) (* x y) (+ (* a b) (* c i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -7.2e+175) || !((x * y) <= 3e+133)) {
tmp = x * y;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
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 (((x * y) <= (-7.2d+175)) .or. (.not. ((x * y) <= 3d+133))) then
tmp = x * y
else
tmp = (a * b) + (c * i)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -7.2e+175) || !((x * y) <= 3e+133)) {
tmp = x * y;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -7.2e+175) or not ((x * y) <= 3e+133): tmp = x * y else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -7.2e+175) || !(Float64(x * y) <= 3e+133)) tmp = Float64(x * y); else tmp = Float64(Float64(a * b) + Float64(c * i)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -7.2e+175) || ~(((x * y) <= 3e+133))) tmp = x * y; else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -7.2e+175], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3e+133]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -7.2 \cdot 10^{+175} \lor \neg \left(x \cdot y \leq 3 \cdot 10^{+133}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -7.20000000000000067e175 or 3.00000000000000007e133 < (*.f64 x y) Initial program 84.9%
+-commutative84.9%
fma-def87.7%
+-commutative87.7%
fma-def91.8%
fma-def91.8%
Simplified91.8%
fma-udef87.7%
fma-def87.7%
associate-+r+87.7%
Applied egg-rr87.7%
Taylor expanded in z around 0 77.4%
Taylor expanded in x around inf 67.1%
if -7.20000000000000067e175 < (*.f64 x y) < 3.00000000000000007e133Initial program 97.8%
Taylor expanded in a around inf 65.5%
Final simplification65.9%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= z -2.35e+172) (not (<= z 4.5e-17))) (+ (* x y) (* z t)) (+ (* c i) (+ (* a b) (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z <= -2.35e+172) || !(z <= 4.5e-17)) {
tmp = (x * y) + (z * t);
} else {
tmp = (c * i) + ((a * b) + (x * y));
}
return tmp;
}
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 <= (-2.35d+172)) .or. (.not. (z <= 4.5d-17))) then
tmp = (x * y) + (z * t)
else
tmp = (c * i) + ((a * b) + (x * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z <= -2.35e+172) || !(z <= 4.5e-17)) {
tmp = (x * y) + (z * t);
} else {
tmp = (c * i) + ((a * b) + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z <= -2.35e+172) or not (z <= 4.5e-17): tmp = (x * y) + (z * t) else: tmp = (c * i) + ((a * b) + (x * y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((z <= -2.35e+172) || !(z <= 4.5e-17)) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z <= -2.35e+172) || ~((z <= 4.5e-17))) tmp = (x * y) + (z * t); else tmp = (c * i) + ((a * b) + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[z, -2.35e+172], N[Not[LessEqual[z, 4.5e-17]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+172} \lor \neg \left(z \leq 4.5 \cdot 10^{-17}\right):\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\
\end{array}
\end{array}
if z < -2.3500000000000001e172 or 4.49999999999999978e-17 < z Initial program 96.0%
Taylor expanded in a around 0 77.8%
Taylor expanded in c around 0 66.2%
if -2.3500000000000001e172 < z < 4.49999999999999978e-17Initial program 92.9%
Taylor expanded in z around 0 86.1%
Final simplification78.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -2.4e+166) (not (<= (* c i) 2e+121))) (* c i) (* a b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -2.4e+166) || !((c * i) <= 2e+121)) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
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) <= (-2.4d+166)) .or. (.not. ((c * i) <= 2d+121))) then
tmp = c * i
else
tmp = a * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -2.4e+166) || !((c * i) <= 2e+121)) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -2.4e+166) or not ((c * i) <= 2e+121): tmp = c * i else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -2.4e+166) || !(Float64(c * i) <= 2e+121)) tmp = Float64(c * i); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -2.4e+166) || ~(((c * i) <= 2e+121))) tmp = c * i; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -2.4e+166], N[Not[LessEqual[N[(c * i), $MachinePrecision], 2e+121]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.4 \cdot 10^{+166} \lor \neg \left(c \cdot i \leq 2 \cdot 10^{+121}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -2.39999999999999992e166 or 2.00000000000000007e121 < (*.f64 c i) Initial program 91.6%
Taylor expanded in c around inf 72.6%
if -2.39999999999999992e166 < (*.f64 c i) < 2.00000000000000007e121Initial program 95.1%
+-commutative95.1%
fma-def95.1%
+-commutative95.1%
fma-def96.2%
fma-def96.2%
Simplified96.2%
fma-udef95.1%
fma-def95.1%
associate-+r+95.1%
Applied egg-rr95.1%
Taylor expanded in z around 0 68.2%
Taylor expanded in a around inf 41.2%
Final simplification50.0%
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
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
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
def code(x, y, z, t, a, b, c, i): return a * b
function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 94.1%
+-commutative94.1%
fma-def95.3%
+-commutative95.3%
fma-def96.5%
fma-def96.5%
Simplified96.5%
fma-udef95.3%
fma-def95.3%
associate-+r+95.3%
Applied egg-rr95.3%
Taylor expanded in z around 0 74.5%
Taylor expanded in a around inf 33.2%
Final simplification33.2%
herbie shell --seed 2024024
(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)))