
(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 12 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 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t)))))) (if (<= t_1 INFINITY) t_1 (* b (+ a (/ (* z t) 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 = b * (a + ((z * t) / 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 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = b * (a + ((z * t) / b));
}
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 = b * (a + ((z * t) / 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 = Float64(b * Float64(a + Float64(Float64(z * t) / b))); 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 = b * (a + ((z * t) / b)); 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[(b * N[(a + N[(N[(z * t), $MachinePrecision] / b), $MachinePrecision]), $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}:\\
\;\;\;\;b \cdot \left(a + \frac{z \cdot t}{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%
Taylor expanded in c around 0 42.9%
Taylor expanded in b around inf 57.1%
Taylor expanded in t around inf 72.0%
Final simplification99.2%
(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 97.2%
+-commutative97.2%
fma-define98.4%
+-commutative98.4%
fma-define98.8%
fma-define99.2%
Simplified99.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1.75e+56) (not (<= (* x y) 4.8e+36))) (+ (* a b) (+ (* x y) (* z t))) (+ (* c i) (+ (* 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 (((x * y) <= -1.75e+56) || !((x * y) <= 4.8e+36)) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = (c * i) + ((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 (((x * y) <= (-1.75d+56)) .or. (.not. ((x * y) <= 4.8d+36))) then
tmp = (a * b) + ((x * y) + (z * t))
else
tmp = (c * i) + ((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 (((x * y) <= -1.75e+56) || !((x * y) <= 4.8e+36)) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = (c * i) + ((a * b) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -1.75e+56) or not ((x * y) <= 4.8e+36): tmp = (a * b) + ((x * y) + (z * t)) else: tmp = (c * i) + ((a * b) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1.75e+56) || !(Float64(x * y) <= 4.8e+36)) tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); else tmp = Float64(Float64(c * i) + 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 (((x * y) <= -1.75e+56) || ~(((x * y) <= 4.8e+36))) tmp = (a * b) + ((x * y) + (z * t)); else tmp = (c * i) + ((a * b) + (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1.75e+56], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4.8e+36]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.75 \cdot 10^{+56} \lor \neg \left(x \cdot y \leq 4.8 \cdot 10^{+36}\right):\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.75e56 or 4.79999999999999985e36 < (*.f64 x y) Initial program 97.1%
Taylor expanded in c around 0 91.1%
if -1.75e56 < (*.f64 x y) < 4.79999999999999985e36Initial program 97.3%
Taylor expanded in x around 0 94.4%
Final simplification93.0%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -8.8e+228)
(* c i)
(if (<= (* c i) 3e+179)
(+ (* a b) (+ (* 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) {
double tmp;
if ((c * i) <= -8.8e+228) {
tmp = c * i;
} else if ((c * i) <= 3e+179) {
tmp = (a * b) + ((x * y) + (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 ((c * i) <= (-8.8d+228)) then
tmp = c * i
else if ((c * i) <= 3d+179) then
tmp = (a * b) + ((x * y) + (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 ((c * i) <= -8.8e+228) {
tmp = c * i;
} else if ((c * i) <= 3e+179) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -8.8e+228: tmp = c * i elif (c * i) <= 3e+179: tmp = (a * b) + ((x * y) + (z * t)) else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -8.8e+228) tmp = Float64(c * i); elseif (Float64(c * i) <= 3e+179) tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + 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 ((c * i) <= -8.8e+228) tmp = c * i; elseif ((c * i) <= 3e+179) tmp = (a * b) + ((x * y) + (z * t)); else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -8.8e+228], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 3e+179], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -8.8 \cdot 10^{+228}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 3 \cdot 10^{+179}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -8.8000000000000001e228Initial program 90.5%
Taylor expanded in c around inf 86.6%
if -8.8000000000000001e228 < (*.f64 c i) < 2.9999999999999998e179Initial program 99.0%
Taylor expanded in c around 0 88.8%
if 2.9999999999999998e179 < (*.f64 c i) Initial program 88.5%
Taylor expanded in z around inf 81.1%
Taylor expanded in z around inf 84.6%
Taylor expanded in t around 0 77.2%
Final simplification87.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -2.2e+30) (* a b) (if (<= (* a b) 0.0) (* x y) (if (<= (* a b) 7.8e+214) (* 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) <= -2.2e+30) {
tmp = a * b;
} else if ((a * b) <= 0.0) {
tmp = x * y;
} else if ((a * b) <= 7.8e+214) {
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) <= (-2.2d+30)) then
tmp = a * b
else if ((a * b) <= 0.0d0) then
tmp = x * y
else if ((a * b) <= 7.8d+214) 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) <= -2.2e+30) {
tmp = a * b;
} else if ((a * b) <= 0.0) {
tmp = x * y;
} else if ((a * b) <= 7.8e+214) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -2.2e+30: tmp = a * b elif (a * b) <= 0.0: tmp = x * y elif (a * b) <= 7.8e+214: 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) <= -2.2e+30) tmp = Float64(a * b); elseif (Float64(a * b) <= 0.0) tmp = Float64(x * y); elseif (Float64(a * b) <= 7.8e+214) 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) <= -2.2e+30) tmp = a * b; elseif ((a * b) <= 0.0) tmp = x * y; elseif ((a * b) <= 7.8e+214) 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], -2.2e+30], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 0.0], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 7.8e+214], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.2 \cdot 10^{+30}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 0:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 7.8 \cdot 10^{+214}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -2.2e30 or 7.80000000000000027e214 < (*.f64 a b) Initial program 93.7%
Taylor expanded in a around inf 73.4%
if -2.2e30 < (*.f64 a b) < -0.0Initial program 100.0%
Taylor expanded in x around inf 40.3%
if -0.0 < (*.f64 a b) < 7.80000000000000027e214Initial program 97.8%
Taylor expanded in z around inf 40.2%
Final simplification50.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -2e+30) (+ (* a b) (* z t)) (if (<= (* a b) 1e+182) (+ (* x y) (* z t)) (* b (+ a (/ (* z t) b))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -2e+30) {
tmp = (a * b) + (z * t);
} else if ((a * b) <= 1e+182) {
tmp = (x * y) + (z * t);
} else {
tmp = b * (a + ((z * t) / 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) <= (-2d+30)) then
tmp = (a * b) + (z * t)
else if ((a * b) <= 1d+182) then
tmp = (x * y) + (z * t)
else
tmp = b * (a + ((z * t) / 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) <= -2e+30) {
tmp = (a * b) + (z * t);
} else if ((a * b) <= 1e+182) {
tmp = (x * y) + (z * t);
} else {
tmp = b * (a + ((z * t) / b));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -2e+30: tmp = (a * b) + (z * t) elif (a * b) <= 1e+182: tmp = (x * y) + (z * t) else: tmp = b * (a + ((z * t) / b)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -2e+30) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (Float64(a * b) <= 1e+182) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(b * Float64(a + Float64(Float64(z * t) / b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -2e+30) tmp = (a * b) + (z * t); elseif ((a * b) <= 1e+182) tmp = (x * y) + (z * t); else tmp = b * (a + ((z * t) / b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e+30], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+182], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(b * N[(a + N[(N[(z * t), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+30}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 10^{+182}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a + \frac{z \cdot t}{b}\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -2e30Initial program 96.3%
Taylor expanded in z around inf 96.3%
Taylor expanded in z around inf 87.1%
Taylor expanded in c around 0 81.7%
if -2e30 < (*.f64 a b) < 1.0000000000000001e182Initial program 98.8%
Taylor expanded in c around 0 73.0%
Taylor expanded in b around inf 56.0%
Taylor expanded in b around 0 65.9%
if 1.0000000000000001e182 < (*.f64 a b) Initial program 90.6%
Taylor expanded in c around 0 93.7%
Taylor expanded in b around inf 96.9%
Taylor expanded in t around inf 100.0%
Final simplification73.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1.95e+133) (not (<= (* x y) 4.4e+73))) (+ (* x y) (* 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 (((x * y) <= -1.95e+133) || !((x * y) <= 4.4e+73)) {
tmp = (x * y) + (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 (((x * y) <= (-1.95d+133)) .or. (.not. ((x * y) <= 4.4d+73))) then
tmp = (x * y) + (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 (((x * y) <= -1.95e+133) || !((x * y) <= 4.4e+73)) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -1.95e+133) or not ((x * y) <= 4.4e+73): tmp = (x * y) + (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(x * y) <= -1.95e+133) || !(Float64(x * y) <= 4.4e+73)) tmp = Float64(Float64(x * y) + 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 (((x * y) <= -1.95e+133) || ~(((x * y) <= 4.4e+73))) tmp = (x * y) + (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[(x * y), $MachinePrecision], -1.95e+133], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4.4e+73]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.95 \cdot 10^{+133} \lor \neg \left(x \cdot y \leq 4.4 \cdot 10^{+73}\right):\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -1.95000000000000007e133 or 4.4e73 < (*.f64 x y) Initial program 96.2%
Taylor expanded in c around 0 92.5%
Taylor expanded in b around inf 69.9%
Taylor expanded in b around 0 84.0%
if -1.95000000000000007e133 < (*.f64 x y) < 4.4e73Initial program 97.7%
Taylor expanded in z around inf 95.0%
Taylor expanded in z around inf 92.3%
Taylor expanded in c around 0 68.6%
Final simplification73.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -9.2e+182) (not (<= (* x y) 2.65e+191))) (* x y) (+ (* 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 (((x * y) <= -9.2e+182) || !((x * y) <= 2.65e+191)) {
tmp = x * y;
} 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 (((x * y) <= (-9.2d+182)) .or. (.not. ((x * y) <= 2.65d+191))) then
tmp = x * y
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 (((x * y) <= -9.2e+182) || !((x * y) <= 2.65e+191)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -9.2e+182) or not ((x * y) <= 2.65e+191): tmp = x * y else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -9.2e+182) || !(Float64(x * y) <= 2.65e+191)) tmp = Float64(x * y); 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 (((x * y) <= -9.2e+182) || ~(((x * y) <= 2.65e+191))) tmp = x * y; else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -9.2e+182], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.65e+191]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -9.2 \cdot 10^{+182} \lor \neg \left(x \cdot y \leq 2.65 \cdot 10^{+191}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -9.2000000000000001e182 or 2.65000000000000015e191 < (*.f64 x y) Initial program 94.5%
Taylor expanded in x around inf 85.7%
if -9.2000000000000001e182 < (*.f64 x y) < 2.65000000000000015e191Initial program 98.0%
Taylor expanded in z around inf 94.2%
Taylor expanded in z around inf 89.5%
Taylor expanded in c around 0 67.1%
Final simplification71.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -3.1e+182) (not (<= (* x y) 2e+142))) (* 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) <= -3.1e+182) || !((x * y) <= 2e+142)) {
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) <= (-3.1d+182)) .or. (.not. ((x * y) <= 2d+142))) 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) <= -3.1e+182) || !((x * y) <= 2e+142)) {
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) <= -3.1e+182) or not ((x * y) <= 2e+142): 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) <= -3.1e+182) || !(Float64(x * y) <= 2e+142)) 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) <= -3.1e+182) || ~(((x * y) <= 2e+142))) 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], -3.1e+182], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+142]], $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 -3.1 \cdot 10^{+182} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+142}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -3.09999999999999996e182 or 2.0000000000000001e142 < (*.f64 x y) Initial program 95.1%
Taylor expanded in x around inf 81.1%
if -3.09999999999999996e182 < (*.f64 x y) < 2.0000000000000001e142Initial program 97.9%
Taylor expanded in z around inf 93.9%
Taylor expanded in z around inf 90.5%
Taylor expanded in t around 0 60.7%
Final simplification65.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= z -2.05e+80) (* z t) (if (<= z -2.1e-285) (* a b) (if (<= z 5.8e-10) (* 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 (z <= -2.05e+80) {
tmp = z * t;
} else if (z <= -2.1e-285) {
tmp = a * b;
} else if (z <= 5.8e-10) {
tmp = c * i;
} else {
tmp = 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 (z <= (-2.05d+80)) then
tmp = z * t
else if (z <= (-2.1d-285)) then
tmp = a * b
else if (z <= 5.8d-10) then
tmp = c * i
else
tmp = 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 (z <= -2.05e+80) {
tmp = z * t;
} else if (z <= -2.1e-285) {
tmp = a * b;
} else if (z <= 5.8e-10) {
tmp = c * i;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if z <= -2.05e+80: tmp = z * t elif z <= -2.1e-285: tmp = a * b elif z <= 5.8e-10: tmp = c * i else: tmp = z * t return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (z <= -2.05e+80) tmp = Float64(z * t); elseif (z <= -2.1e-285) tmp = Float64(a * b); elseif (z <= 5.8e-10) tmp = Float64(c * i); else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (z <= -2.05e+80) tmp = z * t; elseif (z <= -2.1e-285) tmp = a * b; elseif (z <= 5.8e-10) tmp = c * i; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -2.05e+80], N[(z * t), $MachinePrecision], If[LessEqual[z, -2.1e-285], N[(a * b), $MachinePrecision], If[LessEqual[z, 5.8e-10], N[(c * i), $MachinePrecision], N[(z * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+80}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-285}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-10}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if z < -2.05000000000000001e80 or 5.79999999999999962e-10 < z Initial program 96.0%
Taylor expanded in z around inf 49.4%
if -2.05000000000000001e80 < z < -2.09999999999999984e-285Initial program 98.1%
Taylor expanded in a around inf 46.9%
if -2.09999999999999984e-285 < z < 5.79999999999999962e-10Initial program 98.6%
Taylor expanded in c around inf 29.4%
Final simplification43.0%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -1.75e+30) (not (<= (* a b) 4.9e+54))) (* 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 (((a * b) <= -1.75e+30) || !((a * b) <= 4.9e+54)) {
tmp = a * b;
} 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 (((a * b) <= (-1.75d+30)) .or. (.not. ((a * b) <= 4.9d+54))) then
tmp = a * b
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 (((a * b) <= -1.75e+30) || !((a * b) <= 4.9e+54)) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -1.75e+30) or not ((a * b) <= 4.9e+54): tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -1.75e+30) || !(Float64(a * b) <= 4.9e+54)) tmp = Float64(a * b); 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 (((a * b) <= -1.75e+30) || ~(((a * b) <= 4.9e+54))) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -1.75e+30], N[Not[LessEqual[N[(a * b), $MachinePrecision], 4.9e+54]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.75 \cdot 10^{+30} \lor \neg \left(a \cdot b \leq 4.9 \cdot 10^{+54}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 a b) < -1.75000000000000011e30 or 4.90000000000000001e54 < (*.f64 a b) Initial program 94.2%
Taylor expanded in a around inf 63.3%
if -1.75000000000000011e30 < (*.f64 a b) < 4.90000000000000001e54Initial program 99.3%
Taylor expanded in c around inf 30.5%
Final simplification43.9%
(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 97.2%
Taylor expanded in a around inf 29.5%
herbie shell --seed 2024116
(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)))