
(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 15 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 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) {
return fma(c, i, fma(a, b, fma(x, y, (z * t))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(a, b, fma(x, y, Float64(z * t)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
\end{array}
Initial program 95.3%
+-commutative95.3%
fma-def96.9%
+-commutative96.9%
fma-def97.6%
fma-def97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x y z t a b c i) :precision binary64 (fma c i (fma x y (+ (* a b) (* z t)))))
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, ((a * b) + (z * t))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(x, y, Float64(Float64(a * b) + Float64(z * t)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(x * y + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, a \cdot b + z \cdot t\right)\right)
\end{array}
Initial program 95.3%
+-commutative95.3%
fma-def96.9%
associate-+l+96.9%
fma-def97.3%
fma-def97.6%
Simplified97.6%
fma-udef97.3%
Applied egg-rr97.3%
Final simplification97.3%
(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-def33.3%
associate-+l+33.3%
fma-def41.7%
fma-def50.0%
Simplified50.0%
fma-udef41.7%
Applied egg-rr41.7%
fma-udef33.3%
+-commutative33.3%
*-commutative33.3%
associate-+r+33.3%
*-commutative33.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-def96.9%
+-commutative96.9%
fma-def97.6%
fma-def97.6%
Simplified97.6%
fma-udef96.9%
fma-def96.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 (+ (* c i) (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (c * i) + (z * t);
}
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 = (c * i) + (z * t);
}
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 = (c * i) + (z * t) 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(c * i) + Float64(z * t)); 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 = (c * i) + (z * t); 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[(c * i), $MachinePrecision] + N[(z * t), $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}:\\
\;\;\;\;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 33.3%
fma-def41.7%
Simplified41.7%
Taylor expanded in x around 0 43.0%
Final simplification97.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -8.1e+217)
(* c i)
(if (<= (* c i) 1.1e-135)
(* z t)
(if (<= (* c i) 1.5e+68)
(* a b)
(if (<= (* c i) 5.8e+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) <= -8.1e+217) {
tmp = c * i;
} else if ((c * i) <= 1.1e-135) {
tmp = z * t;
} else if ((c * i) <= 1.5e+68) {
tmp = a * b;
} else if ((c * i) <= 5.8e+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) <= (-8.1d+217)) then
tmp = c * i
else if ((c * i) <= 1.1d-135) then
tmp = z * t
else if ((c * i) <= 1.5d+68) then
tmp = a * b
else if ((c * i) <= 5.8d+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) <= -8.1e+217) {
tmp = c * i;
} else if ((c * i) <= 1.1e-135) {
tmp = z * t;
} else if ((c * i) <= 1.5e+68) {
tmp = a * b;
} else if ((c * i) <= 5.8e+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) <= -8.1e+217: tmp = c * i elif (c * i) <= 1.1e-135: tmp = z * t elif (c * i) <= 1.5e+68: tmp = a * b elif (c * i) <= 5.8e+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) <= -8.1e+217) tmp = Float64(c * i); elseif (Float64(c * i) <= 1.1e-135) tmp = Float64(z * t); elseif (Float64(c * i) <= 1.5e+68) tmp = Float64(a * b); elseif (Float64(c * i) <= 5.8e+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) <= -8.1e+217) tmp = c * i; elseif ((c * i) <= 1.1e-135) tmp = z * t; elseif ((c * i) <= 1.5e+68) tmp = a * b; elseif ((c * i) <= 5.8e+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], -8.1e+217], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.1e-135], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.5e+68], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5.8e+136], N[(z * t), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -8.1 \cdot 10^{+217}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 1.1 \cdot 10^{-135}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 1.5 \cdot 10^{+68}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 5.8 \cdot 10^{+136}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -8.0999999999999996e217 or 5.79999999999999949e136 < (*.f64 c i) Initial program 88.0%
Taylor expanded in c around inf 69.7%
if -8.0999999999999996e217 < (*.f64 c i) < 1.1e-135 or 1.5000000000000001e68 < (*.f64 c i) < 5.79999999999999949e136Initial program 98.0%
Taylor expanded in z around inf 45.7%
if 1.1e-135 < (*.f64 c i) < 1.5000000000000001e68Initial 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 (+ (* x y) (* z t)))) (if (or (<= t_1 -1e+95) (not (<= t_1 5e+110))) t_1 (+ (* a b) (* c i)))))
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 ((t_1 <= -1e+95) || !(t_1 <= 5e+110)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x * y) + (z * t)
if ((t_1 <= (-1d+95)) .or. (.not. (t_1 <= 5d+110))) then
tmp = t_1
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 t_1 = (x * y) + (z * t);
double tmp;
if ((t_1 <= -1e+95) || !(t_1 <= 5e+110)) {
tmp = t_1;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if (t_1 <= -1e+95) or not (t_1 <= 5e+110): tmp = t_1 else: tmp = (a * b) + (c * i) 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 ((t_1 <= -1e+95) || !(t_1 <= 5e+110)) tmp = t_1; 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) t_1 = (x * y) + (z * t); tmp = 0.0; if ((t_1 <= -1e+95) || ~((t_1 <= 5e+110))) tmp = t_1; else tmp = (a * b) + (c * i); 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[Or[LessEqual[t$95$1, -1e+95], N[Not[LessEqual[t$95$1, 5e+110]], $MachinePrecision]], t$95$1, N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+95} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+110}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -1.00000000000000002e95 or 4.99999999999999978e110 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 94.0%
+-commutative94.0%
fma-def96.0%
associate-+l+96.0%
fma-def96.7%
fma-def97.3%
Simplified97.3%
fma-udef96.7%
Applied egg-rr96.7%
fma-udef96.0%
+-commutative96.0%
*-commutative96.0%
associate-+r+96.0%
*-commutative96.0%
Applied egg-rr96.0%
fma-udef94.0%
*-commutative94.0%
associate-+r+94.0%
fma-def94.7%
*-commutative94.7%
Applied egg-rr94.7%
Taylor expanded in x around inf 78.1%
if -1.00000000000000002e95 < (+.f64 (*.f64 x y) (*.f64 z t)) < 4.99999999999999978e110Initial program 97.1%
Taylor expanded in x around 0 87.3%
Taylor expanded in t around 0 74.4%
Final simplification76.6%
(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-def88.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) -5.2e+94)
(* x y)
(if (<= (* x y) -3e-45)
(* a b)
(if (<= (* x y) 4.4e+146) (* 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) <= -5.2e+94) {
tmp = x * y;
} else if ((x * y) <= -3e-45) {
tmp = a * b;
} else if ((x * y) <= 4.4e+146) {
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) <= (-5.2d+94)) then
tmp = x * y
else if ((x * y) <= (-3d-45)) then
tmp = a * b
else if ((x * y) <= 4.4d+146) 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) <= -5.2e+94) {
tmp = x * y;
} else if ((x * y) <= -3e-45) {
tmp = a * b;
} else if ((x * y) <= 4.4e+146) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -5.2e+94: tmp = x * y elif (x * y) <= -3e-45: tmp = a * b elif (x * y) <= 4.4e+146: 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) <= -5.2e+94) tmp = Float64(x * y); elseif (Float64(x * y) <= -3e-45) tmp = Float64(a * b); elseif (Float64(x * y) <= 4.4e+146) 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) <= -5.2e+94) tmp = x * y; elseif ((x * y) <= -3e-45) tmp = a * b; elseif ((x * y) <= 4.4e+146) 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], -5.2e+94], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -3e-45], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4.4e+146], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5.2 \cdot 10^{+94}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -3 \cdot 10^{-45}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 4.4 \cdot 10^{+146}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -5.1999999999999998e94 or 4.3999999999999996e146 < (*.f64 x y) Initial program 93.3%
Taylor expanded in x around inf 65.2%
if -5.1999999999999998e94 < (*.f64 x y) < -3.00000000000000011e-45Initial program 99.9%
Taylor expanded in a around inf 48.5%
if -3.00000000000000011e-45 < (*.f64 x y) < 4.3999999999999996e146Initial 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 (<= (* c i) -4.5e+54) (not (<= (* c i) 1.25e+134))) (+ (* c i) (* z t)) (+ (* a b) (* 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) <= -4.5e+54) || !((c * i) <= 1.25e+134)) {
tmp = (c * i) + (z * t);
} else {
tmp = (a * b) + (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) <= (-4.5d+54)) .or. (.not. ((c * i) <= 1.25d+134))) then
tmp = (c * i) + (z * t)
else
tmp = (a * b) + (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) <= -4.5e+54) || !((c * i) <= 1.25e+134)) {
tmp = (c * i) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -4.5e+54) or not ((c * i) <= 1.25e+134): tmp = (c * i) + (z * t) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -4.5e+54) || !(Float64(c * i) <= 1.25e+134)) tmp = Float64(Float64(c * i) + Float64(z * t)); else tmp = Float64(Float64(a * b) + 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) <= -4.5e+54) || ~(((c * i) <= 1.25e+134))) tmp = (c * i) + (z * t); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -4.5e+54], N[Not[LessEqual[N[(c * i), $MachinePrecision], 1.25e+134]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -4.5 \cdot 10^{+54} \lor \neg \left(c \cdot i \leq 1.25 \cdot 10^{+134}\right):\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 c i) < -4.49999999999999984e54 or 1.24999999999999995e134 < (*.f64 c i) Initial program 90.1%
Taylor expanded in a around 0 88.3%
fma-def88.3%
Simplified88.3%
Taylor expanded in x around 0 82.1%
if -4.49999999999999984e54 < (*.f64 c i) < 1.24999999999999995e134Initial program 98.2%
+-commutative98.2%
fma-def98.2%
associate-+l+98.2%
fma-def98.2%
fma-def98.8%
Simplified98.8%
fma-udef98.2%
Applied egg-rr98.2%
fma-udef98.2%
+-commutative98.2%
*-commutative98.2%
associate-+r+98.2%
*-commutative98.2%
Applied egg-rr98.2%
fma-udef98.2%
*-commutative98.2%
associate-+r+98.2%
fma-def98.2%
*-commutative98.2%
Applied egg-rr98.2%
Taylor expanded in a around inf 67.4%
Final simplification72.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -6.2e+128) (+ (* a b) (* c i)) (if (<= (* c i) 4.25e+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) <= -6.2e+128) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 4.25e+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) <= (-6.2d+128)) then
tmp = (a * b) + (c * i)
else if ((c * i) <= 4.25d+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) <= -6.2e+128) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 4.25e+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) <= -6.2e+128: tmp = (a * b) + (c * i) elif (c * i) <= 4.25e+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) <= -6.2e+128) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(c * i) <= 4.25e+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) <= -6.2e+128) tmp = (a * b) + (c * i); elseif ((c * i) <= 4.25e+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], -6.2e+128], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 4.25e+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 -6.2 \cdot 10^{+128}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 4.25 \cdot 10^{+136}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -6.20000000000000008e128Initial program 92.3%
Taylor expanded in x around 0 87.1%
Taylor expanded in t around 0 74.8%
if -6.20000000000000008e128 < (*.f64 c i) < 4.24999999999999983e136Initial program 98.3%
+-commutative98.3%
fma-def98.3%
associate-+l+98.3%
fma-def98.3%
fma-def98.9%
Simplified98.9%
fma-udef98.3%
Applied egg-rr98.3%
fma-udef98.3%
+-commutative98.3%
*-commutative98.3%
associate-+r+98.3%
*-commutative98.3%
Applied egg-rr98.3%
fma-udef98.3%
*-commutative98.3%
associate-+r+98.3%
fma-def98.3%
*-commutative98.3%
Applied egg-rr98.3%
Taylor expanded in a around inf 66.6%
if 4.24999999999999983e136 < (*.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+51) (not (<= (* c i) 5.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+51) || !((c * i) <= 5.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+51)) .or. (.not. ((c * i) <= 5.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+51) || !((c * i) <= 5.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+51) or not ((c * i) <= 5.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+51) || !(Float64(c * i) <= 5.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+51) || ~(((c * i) <= 5.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+51], N[Not[LessEqual[N[(c * i), $MachinePrecision], 5.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^{+51} \lor \neg \left(c \cdot i \leq 5.8 \cdot 10^{+136}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -3.10000000000000011e51 or 5.79999999999999949e136 < (*.f64 c i) Initial program 90.0%
Taylor expanded in c around inf 62.3%
if -3.10000000000000011e51 < (*.f64 c i) < 5.79999999999999949e136Initial 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.3e-20) (not (<= t 8.8e+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.3e-20) || !(t <= 8.8e+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.3d-20)) .or. (.not. (t <= 8.8d+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.3e-20) || !(t <= 8.8e+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.3e-20) or not (t <= 8.8e+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.3e-20) || !(t <= 8.8e+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.3e-20) || ~((t <= 8.8e+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.3e-20], N[Not[LessEqual[t, 8.8e+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.3 \cdot 10^{-20} \lor \neg \left(t \leq 8.8 \cdot 10^{+85}\right):\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if t < -4.30000000000000011e-20 or 8.8000000000000007e85 < t Initial program 94.5%
Taylor expanded in z around inf 51.7%
if -4.30000000000000011e-20 < t < 8.8000000000000007e85Initial program 96.1%
Taylor expanded in x around 0 70.9%
Taylor expanded in t around 0 57.1%
Final simplification54.4%
(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)))