
(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 14 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 (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 95.3%
+-commutative95.3%
fma-define96.9%
associate-+l+96.9%
fma-define97.3%
fma-define97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t)))))) (if (<= t_1 INFINITY) t_1 (fma c i (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(c, i, (a * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(c, i, Float64(a * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(c * i + N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, a \cdot b\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
+-commutative0.0%
fma-define33.3%
associate-+l+33.3%
fma-define41.7%
fma-define50.0%
Simplified50.0%
fma-undefine41.7%
fma-undefine33.3%
associate-+l+33.3%
+-commutative33.3%
associate-+r+33.3%
Applied egg-rr33.3%
Taylor expanded in a around inf 50.1%
Final simplification97.6%
(FPCore (x y z t a b c i) :precision binary64 (fma c i (+ (+ (* a b) (* x y)) (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, (((a * b) + (x * y)) + (z * t)));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, Float64(Float64(Float64(a * b) + Float64(x * y)) + Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \left(a \cdot b + x \cdot y\right) + z \cdot t\right)
\end{array}
Initial program 95.3%
+-commutative95.3%
fma-define96.9%
associate-+l+96.9%
fma-define97.3%
fma-define97.6%
Simplified97.6%
fma-undefine97.3%
fma-undefine96.9%
associate-+l+96.9%
+-commutative96.9%
associate-+r+96.9%
Applied egg-rr96.9%
Final simplification96.9%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t)))))) (if (<= t_1 INFINITY) t_1 (+ (* a b) (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (a * b) + (x * y);
}
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 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + ((a * b) + ((x * y) + (z * t))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (a * b) + (x * y) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(a * b) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (c * i) + ((a * b) + ((x * y) + (z * t))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (a * b) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\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 z around 0 16.7%
associate-+r+16.7%
fma-undefine33.3%
+-commutative33.3%
fma-define50.0%
Simplified50.0%
Taylor expanded in c around 0 50.0%
Final simplification97.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -9.6e+217)
(* c i)
(if (<= (* c i) 1.25e-129)
(* z t)
(if (<= (* c i) 1.55e+68)
(* a b)
(if (<= (* c i) 8.4e+136) (* z t) (* 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) <= -9.6e+217) {
tmp = c * i;
} else if ((c * i) <= 1.25e-129) {
tmp = z * t;
} else if ((c * i) <= 1.55e+68) {
tmp = a * b;
} else if ((c * i) <= 8.4e+136) {
tmp = z * t;
} else {
tmp = 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 ((c * i) <= (-9.6d+217)) then
tmp = c * i
else if ((c * i) <= 1.25d-129) then
tmp = z * t
else if ((c * i) <= 1.55d+68) then
tmp = a * b
else if ((c * i) <= 8.4d+136) then
tmp = z * t
else
tmp = 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 ((c * i) <= -9.6e+217) {
tmp = c * i;
} else if ((c * i) <= 1.25e-129) {
tmp = z * t;
} else if ((c * i) <= 1.55e+68) {
tmp = a * b;
} else if ((c * i) <= 8.4e+136) {
tmp = z * t;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -9.6e+217: tmp = c * i elif (c * i) <= 1.25e-129: tmp = z * t elif (c * i) <= 1.55e+68: tmp = a * b elif (c * i) <= 8.4e+136: tmp = z * t else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -9.6e+217) tmp = Float64(c * i); elseif (Float64(c * i) <= 1.25e-129) tmp = Float64(z * t); elseif (Float64(c * i) <= 1.55e+68) tmp = Float64(a * b); elseif (Float64(c * i) <= 8.4e+136) tmp = Float64(z * t); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -9.6e+217) tmp = c * i; elseif ((c * i) <= 1.25e-129) tmp = z * t; elseif ((c * i) <= 1.55e+68) tmp = a * b; elseif ((c * i) <= 8.4e+136) tmp = z * t; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -9.6e+217], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.25e-129], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.55e+68], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 8.4e+136], N[(z * t), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -9.6 \cdot 10^{+217}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 1.25 \cdot 10^{-129}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 1.55 \cdot 10^{+68}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 8.4 \cdot 10^{+136}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -9.5999999999999992e217 or 8.3999999999999996e136 < (*.f64 c i) Initial program 88.0%
Taylor expanded in c around inf 69.7%
if -9.5999999999999992e217 < (*.f64 c i) < 1.25000000000000007e-129 or 1.5499999999999999e68 < (*.f64 c i) < 8.3999999999999996e136Initial program 98.0%
Taylor expanded in z around inf 45.7%
if 1.25000000000000007e-129 < (*.f64 c i) < 1.5499999999999999e68Initial program 97.5%
Taylor expanded in a around inf 39.0%
Final simplification50.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* a b) (* x y))))
(if (<= (* x y) -450.0)
t_1
(if (<= (* x y) -3.5e-251)
(+ (* a b) (* c i))
(if (<= (* x y) 1.52e+147) (+ (* a b) (* z t)) t_1)))))
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 tmp;
if ((x * y) <= -450.0) {
tmp = t_1;
} else if ((x * y) <= -3.5e-251) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 1.52e+147) {
tmp = (a * b) + (z * t);
} else {
tmp = t_1;
}
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) :: tmp
t_1 = (a * b) + (x * y)
if ((x * y) <= (-450.0d0)) then
tmp = t_1
else if ((x * y) <= (-3.5d-251)) then
tmp = (a * b) + (c * i)
else if ((x * y) <= 1.52d+147) then
tmp = (a * b) + (z * t)
else
tmp = t_1
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 tmp;
if ((x * y) <= -450.0) {
tmp = t_1;
} else if ((x * y) <= -3.5e-251) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 1.52e+147) {
tmp = (a * b) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (a * b) + (x * y) tmp = 0 if (x * y) <= -450.0: tmp = t_1 elif (x * y) <= -3.5e-251: tmp = (a * b) + (c * i) elif (x * y) <= 1.52e+147: tmp = (a * b) + (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(a * b) + Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -450.0) tmp = t_1; elseif (Float64(x * y) <= -3.5e-251) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(x * y) <= 1.52e+147) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (a * b) + (x * y); tmp = 0.0; if ((x * y) <= -450.0) tmp = t_1; elseif ((x * y) <= -3.5e-251) tmp = (a * b) + (c * i); elseif ((x * y) <= 1.52e+147) tmp = (a * b) + (z * t); else tmp = t_1; 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]}, If[LessEqual[N[(x * y), $MachinePrecision], -450.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -3.5e-251], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.52e+147], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -450:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -3.5 \cdot 10^{-251}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 1.52 \cdot 10^{+147}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -450 or 1.51999999999999992e147 < (*.f64 x y) Initial program 94.7%
Taylor expanded in z around 0 81.5%
associate-+r+81.5%
fma-undefine81.5%
+-commutative81.5%
fma-define83.6%
Simplified83.6%
Taylor expanded in c around 0 73.4%
if -450 < (*.f64 x y) < -3.50000000000000034e-251Initial program 97.4%
Taylor expanded in x around 0 92.6%
Taylor expanded in a around inf 67.8%
if -3.50000000000000034e-251 < (*.f64 x y) < 1.51999999999999992e147Initial program 95.1%
+-commutative95.1%
fma-define97.5%
associate-+l+97.5%
fma-define97.5%
fma-define97.5%
Simplified97.5%
fma-undefine97.5%
fma-undefine97.5%
associate-+l+97.5%
+-commutative97.5%
associate-+r+97.5%
Applied egg-rr97.5%
Taylor expanded in x around 0 92.1%
Taylor expanded in c around 0 69.1%
Final simplification70.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -1.3e+54) (not (<= (* c i) 3.5e+135))) (+ (* c i) (* z t)) (+ (* a b) (+ (* 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 (((c * i) <= -1.3e+54) || !((c * i) <= 3.5e+135)) {
tmp = (c * i) + (z * t);
} else {
tmp = (a * b) + ((x * y) + (z * t));
}
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) <= (-1.3d+54)) .or. (.not. ((c * i) <= 3.5d+135))) then
tmp = (c * i) + (z * t)
else
tmp = (a * b) + ((x * y) + (z * t))
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) <= -1.3e+54) || !((c * i) <= 3.5e+135)) {
tmp = (c * i) + (z * t);
} else {
tmp = (a * b) + ((x * y) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -1.3e+54) or not ((c * i) <= 3.5e+135): tmp = (c * i) + (z * t) else: tmp = (a * b) + ((x * y) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -1.3e+54) || !(Float64(c * i) <= 3.5e+135)) tmp = Float64(Float64(c * i) + Float64(z * t)); else tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -1.3e+54) || ~(((c * i) <= 3.5e+135))) tmp = (c * i) + (z * t); else tmp = (a * b) + ((x * y) + (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -1.3e+54], N[Not[LessEqual[N[(c * i), $MachinePrecision], 3.5e+135]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.3 \cdot 10^{+54} \lor \neg \left(c \cdot i \leq 3.5 \cdot 10^{+135}\right):\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -1.30000000000000003e54 or 3.5000000000000003e135 < (*.f64 c i) Initial program 90.1%
Taylor expanded in a around 0 88.3%
fma-define88.3%
Simplified88.3%
Taylor expanded in x around 0 82.1%
if -1.30000000000000003e54 < (*.f64 c i) < 3.5000000000000003e135Initial program 98.2%
Taylor expanded in c around 0 96.4%
Final simplification91.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -6e+49) (not (<= (* c i) 7e+64))) (+ (* c i) (+ (* a b) (* z t))) (+ (* a b) (+ (* 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 (((c * i) <= -6e+49) || !((c * i) <= 7e+64)) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = (a * b) + ((x * y) + (z * t));
}
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) <= (-6d+49)) .or. (.not. ((c * i) <= 7d+64))) then
tmp = (c * i) + ((a * b) + (z * t))
else
tmp = (a * b) + ((x * y) + (z * t))
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) <= -6e+49) || !((c * i) <= 7e+64)) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = (a * b) + ((x * y) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -6e+49) or not ((c * i) <= 7e+64): tmp = (c * i) + ((a * b) + (z * t)) else: tmp = (a * b) + ((x * y) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -6e+49) || !(Float64(c * i) <= 7e+64)) tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t))); else tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -6e+49) || ~(((c * i) <= 7e+64))) tmp = (c * i) + ((a * b) + (z * t)); else tmp = (a * b) + ((x * y) + (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -6e+49], N[Not[LessEqual[N[(c * i), $MachinePrecision], 7e+64]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -6 \cdot 10^{+49} \lor \neg \left(c \cdot i \leq 7 \cdot 10^{+64}\right):\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -6.0000000000000005e49 or 6.9999999999999997e64 < (*.f64 c i) Initial program 91.1%
Taylor expanded in x around 0 85.9%
if -6.0000000000000005e49 < (*.f64 c i) < 6.9999999999999997e64Initial program 98.0%
Taylor expanded in c around 0 96.8%
Final simplification92.5%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -2.6e+101)
(* x y)
(if (<= (* x y) -1.4e-46)
(* a b)
(if (<= (* x y) 1.7e+148) (* z t) (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -2.6e+101) {
tmp = x * y;
} else if ((x * y) <= -1.4e-46) {
tmp = a * b;
} else if ((x * y) <= 1.7e+148) {
tmp = z * t;
} else {
tmp = 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 ((x * y) <= (-2.6d+101)) then
tmp = x * y
else if ((x * y) <= (-1.4d-46)) then
tmp = a * b
else if ((x * y) <= 1.7d+148) then
tmp = z * t
else
tmp = 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 ((x * y) <= -2.6e+101) {
tmp = x * y;
} else if ((x * y) <= -1.4e-46) {
tmp = a * b;
} else if ((x * y) <= 1.7e+148) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -2.6e+101: tmp = x * y elif (x * y) <= -1.4e-46: tmp = a * b elif (x * y) <= 1.7e+148: tmp = z * t else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -2.6e+101) tmp = Float64(x * y); elseif (Float64(x * y) <= -1.4e-46) tmp = Float64(a * b); elseif (Float64(x * y) <= 1.7e+148) tmp = Float64(z * t); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -2.6e+101) tmp = x * y; elseif ((x * y) <= -1.4e-46) tmp = a * b; elseif ((x * y) <= 1.7e+148) tmp = z * t; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -2.6e+101], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1.4e-46], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.7e+148], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.6 \cdot 10^{+101}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -1.4 \cdot 10^{-46}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 1.7 \cdot 10^{+148}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -2.6e101 or 1.7000000000000001e148 < (*.f64 x y) Initial program 93.3%
Taylor expanded in x around inf 65.2%
if -2.6e101 < (*.f64 x y) < -1.3999999999999999e-46Initial program 99.9%
Taylor expanded in a around inf 48.5%
if -1.3999999999999999e-46 < (*.f64 x y) < 1.7000000000000001e148Initial program 95.3%
Taylor expanded in z around inf 45.8%
Final simplification51.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -900.0) (not (<= (* x y) 1.1e+170))) (+ (* a b) (* x y)) (+ (* c i) (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -900.0) || !((x * y) <= 1.1e+170)) {
tmp = (a * b) + (x * y);
} else {
tmp = (c * i) + (z * t);
}
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) <= (-900.0d0)) .or. (.not. ((x * y) <= 1.1d+170))) then
tmp = (a * b) + (x * y)
else
tmp = (c * i) + (z * t)
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) <= -900.0) || !((x * y) <= 1.1e+170)) {
tmp = (a * b) + (x * y);
} else {
tmp = (c * i) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -900.0) or not ((x * y) <= 1.1e+170): tmp = (a * b) + (x * y) else: tmp = (c * i) + (z * t) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -900.0) || !(Float64(x * y) <= 1.1e+170)) tmp = Float64(Float64(a * b) + Float64(x * y)); else tmp = Float64(Float64(c * i) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -900.0) || ~(((x * y) <= 1.1e+170))) tmp = (a * b) + (x * y); else tmp = (c * i) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -900.0], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.1e+170]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -900 \lor \neg \left(x \cdot y \leq 1.1 \cdot 10^{+170}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -900 or 1.09999999999999994e170 < (*.f64 x y) Initial program 94.5%
Taylor expanded in z around 0 81.7%
associate-+r+81.7%
fma-undefine81.7%
+-commutative81.7%
fma-define83.9%
Simplified83.9%
Taylor expanded in c around 0 74.4%
if -900 < (*.f64 x y) < 1.09999999999999994e170Initial program 95.7%
Taylor expanded in a around 0 78.4%
fma-define78.4%
Simplified78.4%
Taylor expanded in x around 0 72.4%
Final simplification73.1%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -5.2e+133) (+ (* a b) (* c i)) (if (<= (* c i) 8.5e+136) (+ (* a b) (* z t)) (* 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) <= -5.2e+133) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 8.5e+136) {
tmp = (a * b) + (z * t);
} else {
tmp = 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 ((c * i) <= (-5.2d+133)) then
tmp = (a * b) + (c * i)
else if ((c * i) <= 8.5d+136) then
tmp = (a * b) + (z * t)
else
tmp = 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 ((c * i) <= -5.2e+133) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 8.5e+136) {
tmp = (a * b) + (z * t);
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -5.2e+133: tmp = (a * b) + (c * i) elif (c * i) <= 8.5e+136: tmp = (a * b) + (z * t) else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -5.2e+133) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(c * i) <= 8.5e+136) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -5.2e+133) tmp = (a * b) + (c * i); elseif ((c * i) <= 8.5e+136) tmp = (a * b) + (z * t); else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -5.2e+133], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 8.5e+136], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(c * i), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -5.2 \cdot 10^{+133}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 8.5 \cdot 10^{+136}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -5.1999999999999995e133Initial program 92.3%
Taylor expanded in x around 0 87.1%
Taylor expanded in a around inf 74.8%
if -5.1999999999999995e133 < (*.f64 c i) < 8.49999999999999966e136Initial program 98.3%
+-commutative98.3%
fma-define98.3%
associate-+l+98.3%
fma-define98.3%
fma-define98.9%
Simplified98.9%
fma-undefine98.9%
fma-undefine98.3%
associate-+l+98.3%
+-commutative98.3%
associate-+r+98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 70.4%
Taylor expanded in c around 0 66.6%
if 8.49999999999999966e136 < (*.f64 c i) Initial program 84.6%
Taylor expanded in c around inf 65.4%
Final simplification67.7%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -3.1e+50) (not (<= (* c i) 2.8e+136))) (* 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) <= -3.1e+50) || !((c * i) <= 2.8e+136)) {
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) <= (-3.1d+50)) .or. (.not. ((c * i) <= 2.8d+136))) 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) <= -3.1e+50) || !((c * i) <= 2.8e+136)) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -3.1e+50) or not ((c * i) <= 2.8e+136): 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) <= -3.1e+50) || !(Float64(c * i) <= 2.8e+136)) 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) <= -3.1e+50) || ~(((c * i) <= 2.8e+136))) 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], -3.1e+50], N[Not[LessEqual[N[(c * i), $MachinePrecision], 2.8e+136]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.1 \cdot 10^{+50} \lor \neg \left(c \cdot i \leq 2.8 \cdot 10^{+136}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -3.10000000000000003e50 or 2.8000000000000002e136 < (*.f64 c i) Initial program 90.0%
Taylor expanded in c around inf 62.3%
if -3.10000000000000003e50 < (*.f64 c i) < 2.8000000000000002e136Initial program 98.2%
Taylor expanded in a around inf 31.6%
Final simplification42.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= t -4.5e-21) (not (<= t 7.2e+85))) (* z t) (+ (* 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 ((t <= -4.5e-21) || !(t <= 7.2e+85)) {
tmp = z * t;
} 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 ((t <= (-4.5d-21)) .or. (.not. (t <= 7.2d+85))) then
tmp = z * t
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 ((t <= -4.5e-21) || !(t <= 7.2e+85)) {
tmp = z * t;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (t <= -4.5e-21) or not (t <= 7.2e+85): tmp = z * t else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((t <= -4.5e-21) || !(t <= 7.2e+85)) tmp = Float64(z * t); 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 ((t <= -4.5e-21) || ~((t <= 7.2e+85))) tmp = z * t; else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[t, -4.5e-21], N[Not[LessEqual[t, 7.2e+85]], $MachinePrecision]], N[(z * t), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{-21} \lor \neg \left(t \leq 7.2 \cdot 10^{+85}\right):\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if t < -4.49999999999999968e-21 or 7.1999999999999996e85 < t Initial program 94.5%
Taylor expanded in z around inf 52.1%
if -4.49999999999999968e-21 < t < 7.1999999999999996e85Initial program 96.0%
Taylor expanded in x around 0 70.7%
Taylor expanded in a around inf 57.5%
Final simplification54.8%
(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 95.3%
Taylor expanded in a around inf 25.6%
Final simplification25.6%
herbie shell --seed 2024034
(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)))