
(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 (if (<= (+ (* a b) (+ (* z t) (* x y))) INFINITY) (fma c i (fma x y (fma z t (* a b)))) (* x y)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) + ((z * t) + (x * y))) <= ((double) INFINITY)) {
tmp = fma(c, i, fma(x, y, fma(z, t, (a * b))));
} else {
tmp = x * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) <= Inf) tmp = fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))); else tmp = Float64(x * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b + \left(z \cdot t + x \cdot y\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 96.3%
+-commutative96.3%
fma-def98.8%
associate-+l+98.8%
fma-def98.8%
fma-def98.8%
Simplified98.8%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in x around inf 56.2%
Final simplification97.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (+ (* c i) (+ (* a b) (+ (* z t) (* x y)))) INFINITY) (+ (* z t) (+ (* x y) (fma a b (* c i)))) (fma y x (* 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) + ((a * b) + ((z * t) + (x * y)))) <= ((double) INFINITY)) {
tmp = (z * t) + ((x * y) + fma(a, b, (c * i)));
} else {
tmp = fma(y, x, (z * t));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y)))) <= Inf) tmp = Float64(Float64(z * t) + Float64(Float64(x * y) + fma(a, b, Float64(c * i)))); else tmp = fma(y, x, Float64(z * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(z * t), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i + \left(a \cdot b + \left(z \cdot t + x \cdot y\right)\right) \leq \infty:\\
\;\;\;\;z \cdot t + \left(x \cdot y + \mathsf{fma}\left(a, b, c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
+-commutative100.0%
fma-def100.0%
associate-+l+100.0%
fma-def100.0%
fma-def100.0%
Simplified100.0%
fma-udef100.0%
fma-udef100.0%
fma-udef100.0%
associate-+l+100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+r+100.0%
fma-def100.0%
Applied egg-rr100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
associate-+l+0.0%
associate-+l+0.0%
fma-def5.6%
fma-def22.2%
fma-def27.8%
Simplified27.8%
Taylor expanded in a around 0 27.8%
Taylor expanded in c around 0 44.7%
fma-def50.2%
Simplified50.2%
Final simplification96.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (+ (* a b) (+ (* z t) (* x y))) INFINITY) (fma c i (+ (* z t) (+ (* a b) (* x y)))) (* x y)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) + ((z * t) + (x * y))) <= ((double) INFINITY)) {
tmp = fma(c, i, ((z * t) + ((a * b) + (x * y))));
} else {
tmp = x * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) <= Inf) tmp = fma(c, i, Float64(Float64(z * t) + Float64(Float64(a * b) + Float64(x * y)))); else tmp = Float64(x * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(c * i + N[(N[(z * t), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b + \left(z \cdot t + x \cdot y\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(c, i, z \cdot t + \left(a \cdot b + x \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 96.3%
+-commutative96.3%
fma-def98.8%
associate-+l+98.8%
fma-def98.8%
fma-def98.8%
Simplified98.8%
fma-udef98.8%
fma-udef98.8%
associate-+l+98.8%
+-commutative98.8%
associate-+r+98.8%
Applied egg-rr98.8%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in x around inf 56.2%
Final simplification97.3%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* z t) (* x y)))))) (if (<= t_1 INFINITY) t_1 (fma 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) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(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(z * t) + Float64(x * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(a, b, Float64(x * y)); 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[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(z \cdot t + x \cdot y\right)\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\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 z around 0 38.9%
fma-def44.4%
Simplified44.4%
Taylor expanded in c around 0 39.7%
fma-def45.3%
Simplified45.3%
Final simplification96.1%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* z t) (* x y)))))) (if (<= t_1 INFINITY) t_1 (fma y x (* 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) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(y, x, (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(z * t) + Float64(x * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(y, x, Float64(z * t)); 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[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(y * x + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(z \cdot t + x \cdot y\right)\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
associate-+l+0.0%
associate-+l+0.0%
fma-def5.6%
fma-def22.2%
fma-def27.8%
Simplified27.8%
Taylor expanded in a around 0 27.8%
Taylor expanded in c around 0 44.7%
fma-def50.2%
Simplified50.2%
Final simplification96.5%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* z t) (* x y))) (t_2 (+ (* c i) (+ (* a b) t_1)))) (if (<= t_2 INFINITY) t_2 t_1)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (z * t) + (x * y);
double t_2 = (c * i) + ((a * b) + t_1);
double tmp;
if (t_2 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = t_1;
}
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 = (z * t) + (x * y);
double t_2 = (c * i) + ((a * b) + t_1);
double tmp;
if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (z * t) + (x * y) t_2 = (c * i) + ((a * b) + t_1) tmp = 0 if t_2 <= math.inf: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(z * t) + Float64(x * y)) t_2 = Float64(Float64(c * i) + Float64(Float64(a * b) + t_1)) tmp = 0.0 if (t_2 <= Inf) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (z * t) + (x * y); t_2 = (c * i) + ((a * b) + t_1); tmp = 0.0; if (t_2 <= Inf) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, Infinity], t$95$2, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t + x \cdot y\\
t_2 := c \cdot i + \left(a \cdot b + t_1\right)\\
\mathbf{if}\;t_2 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
associate-+l+0.0%
associate-+l+0.0%
fma-def5.6%
fma-def22.2%
fma-def27.8%
Simplified27.8%
Taylor expanded in a around 0 27.8%
Taylor expanded in c around 0 44.7%
Final simplification96.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -1.2e+59)
(* a b)
(if (<= (* a b) 2e-294)
(* x y)
(if (<= (* a b) 3.8e-241)
(* z t)
(if (<= (* a b) 1.85e-23)
(* x y)
(if (<= (* a b) 1.12e+64)
(* c i)
(if (<= (* a b) 3.2e+72) (* x y) (* 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) <= -1.2e+59) {
tmp = a * b;
} else if ((a * b) <= 2e-294) {
tmp = x * y;
} else if ((a * b) <= 3.8e-241) {
tmp = z * t;
} else if ((a * b) <= 1.85e-23) {
tmp = x * y;
} else if ((a * b) <= 1.12e+64) {
tmp = c * i;
} else if ((a * b) <= 3.2e+72) {
tmp = x * y;
} 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) <= (-1.2d+59)) then
tmp = a * b
else if ((a * b) <= 2d-294) then
tmp = x * y
else if ((a * b) <= 3.8d-241) then
tmp = z * t
else if ((a * b) <= 1.85d-23) then
tmp = x * y
else if ((a * b) <= 1.12d+64) then
tmp = c * i
else if ((a * b) <= 3.2d+72) then
tmp = x * y
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) <= -1.2e+59) {
tmp = a * b;
} else if ((a * b) <= 2e-294) {
tmp = x * y;
} else if ((a * b) <= 3.8e-241) {
tmp = z * t;
} else if ((a * b) <= 1.85e-23) {
tmp = x * y;
} else if ((a * b) <= 1.12e+64) {
tmp = c * i;
} else if ((a * b) <= 3.2e+72) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1.2e+59: tmp = a * b elif (a * b) <= 2e-294: tmp = x * y elif (a * b) <= 3.8e-241: tmp = z * t elif (a * b) <= 1.85e-23: tmp = x * y elif (a * b) <= 1.12e+64: tmp = c * i elif (a * b) <= 3.2e+72: tmp = x * y else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1.2e+59) tmp = Float64(a * b); elseif (Float64(a * b) <= 2e-294) tmp = Float64(x * y); elseif (Float64(a * b) <= 3.8e-241) tmp = Float64(z * t); elseif (Float64(a * b) <= 1.85e-23) tmp = Float64(x * y); elseif (Float64(a * b) <= 1.12e+64) tmp = Float64(c * i); elseif (Float64(a * b) <= 3.2e+72) tmp = Float64(x * y); 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) <= -1.2e+59) tmp = a * b; elseif ((a * b) <= 2e-294) tmp = x * y; elseif ((a * b) <= 3.8e-241) tmp = z * t; elseif ((a * b) <= 1.85e-23) tmp = x * y; elseif ((a * b) <= 1.12e+64) tmp = c * i; elseif ((a * b) <= 3.2e+72) tmp = x * y; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.2e+59], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e-294], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.8e-241], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.85e-23], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.12e+64], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.2e+72], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.2 \cdot 10^{+59}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-294}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 3.8 \cdot 10^{-241}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.85 \cdot 10^{-23}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.12 \cdot 10^{+64}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 3.2 \cdot 10^{+72}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.2000000000000001e59 or 3.2000000000000001e72 < (*.f64 a b) Initial program 92.7%
Taylor expanded in a around inf 62.0%
if -1.2000000000000001e59 < (*.f64 a b) < 2.00000000000000003e-294 or 3.7999999999999999e-241 < (*.f64 a b) < 1.8500000000000001e-23 or 1.11999999999999995e64 < (*.f64 a b) < 3.2000000000000001e72Initial program 94.1%
Taylor expanded in x around inf 48.5%
if 2.00000000000000003e-294 < (*.f64 a b) < 3.7999999999999999e-241Initial program 100.0%
Taylor expanded in z around inf 55.9%
if 1.8500000000000001e-23 < (*.f64 a b) < 1.11999999999999995e64Initial program 85.7%
Taylor expanded in c around inf 42.9%
Final simplification54.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -5.6e+139) (not (<= (* c i) 1.25e+218))) (+ (* a b) (* c i)) (+ (* a b) (+ (* 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 (((c * i) <= -5.6e+139) || !((c * i) <= 1.25e+218)) {
tmp = (a * b) + (c * i);
} else {
tmp = (a * b) + ((z * t) + (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 (((c * i) <= (-5.6d+139)) .or. (.not. ((c * i) <= 1.25d+218))) then
tmp = (a * b) + (c * i)
else
tmp = (a * b) + ((z * t) + (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 (((c * i) <= -5.6e+139) || !((c * i) <= 1.25e+218)) {
tmp = (a * b) + (c * i);
} else {
tmp = (a * b) + ((z * t) + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -5.6e+139) or not ((c * i) <= 1.25e+218): tmp = (a * b) + (c * i) else: tmp = (a * b) + ((z * t) + (x * y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -5.6e+139) || !(Float64(c * i) <= 1.25e+218)) tmp = Float64(Float64(a * b) + Float64(c * i)); else tmp = Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -5.6e+139) || ~(((c * i) <= 1.25e+218))) tmp = (a * b) + (c * i); else tmp = (a * b) + ((z * t) + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -5.6e+139], N[Not[LessEqual[N[(c * i), $MachinePrecision], 1.25e+218]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -5.6 \cdot 10^{+139} \lor \neg \left(c \cdot i \leq 1.25 \cdot 10^{+218}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(z \cdot t + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -5.5999999999999997e139 or 1.24999999999999996e218 < (*.f64 c i) Initial program 82.2%
Taylor expanded in x around 0 77.0%
fma-def78.4%
Simplified78.4%
Taylor expanded in t around 0 75.7%
if -5.5999999999999997e139 < (*.f64 c i) < 1.24999999999999996e218Initial program 97.2%
Taylor expanded in c around 0 88.3%
Final simplification84.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -3.7e+204) (* c i) (if (<= (* c i) 3e+217) (+ (* a b) (* x y)) (* c i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -3.7e+204) {
tmp = c * i;
} else if ((c * i) <= 3e+217) {
tmp = (a * b) + (x * y);
} 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) <= (-3.7d+204)) then
tmp = c * i
else if ((c * i) <= 3d+217) then
tmp = (a * b) + (x * y)
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) <= -3.7e+204) {
tmp = c * i;
} else if ((c * i) <= 3e+217) {
tmp = (a * b) + (x * y);
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -3.7e+204: tmp = c * i elif (c * i) <= 3e+217: tmp = (a * b) + (x * y) else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -3.7e+204) tmp = Float64(c * i); elseif (Float64(c * i) <= 3e+217) tmp = Float64(Float64(a * b) + Float64(x * y)); 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) <= -3.7e+204) tmp = c * i; elseif ((c * i) <= 3e+217) tmp = (a * b) + (x * y); else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -3.7e+204], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 3e+217], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c * i), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.7 \cdot 10^{+204}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 3 \cdot 10^{+217}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -3.7e204 or 2.99999999999999976e217 < (*.f64 c i) Initial program 79.3%
Taylor expanded in c around inf 65.0%
if -3.7e204 < (*.f64 c i) < 2.99999999999999976e217Initial program 97.4%
Taylor expanded in z around 0 78.2%
fma-def78.2%
Simplified78.2%
Taylor expanded in c around 0 69.0%
Final simplification68.0%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= x -4.2e+107)
(+ (* a b) (* x y))
(if (or (<= x -4.8e+36) (not (<= x 7800000.0)))
(+ (* z t) (* 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 <= -4.2e+107) {
tmp = (a * b) + (x * y);
} else if ((x <= -4.8e+36) || !(x <= 7800000.0)) {
tmp = (z * t) + (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 <= (-4.2d+107)) then
tmp = (a * b) + (x * y)
else if ((x <= (-4.8d+36)) .or. (.not. (x <= 7800000.0d0))) then
tmp = (z * t) + (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 <= -4.2e+107) {
tmp = (a * b) + (x * y);
} else if ((x <= -4.8e+36) || !(x <= 7800000.0)) {
tmp = (z * t) + (x * y);
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if x <= -4.2e+107: tmp = (a * b) + (x * y) elif (x <= -4.8e+36) or not (x <= 7800000.0): tmp = (z * t) + (x * y) else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -4.2e+107) tmp = Float64(Float64(a * b) + Float64(x * y)); elseif ((x <= -4.8e+36) || !(x <= 7800000.0)) tmp = Float64(Float64(z * t) + 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 <= -4.2e+107) tmp = (a * b) + (x * y); elseif ((x <= -4.8e+36) || ~((x <= 7800000.0))) tmp = (z * t) + (x * y); else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -4.2e+107], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -4.8e+36], N[Not[LessEqual[x, 7800000.0]], $MachinePrecision]], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+107}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{+36} \lor \neg \left(x \leq 7800000\right):\\
\;\;\;\;z \cdot t + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if x < -4.1999999999999999e107Initial program 89.1%
Taylor expanded in z around 0 89.1%
fma-def91.3%
Simplified91.3%
Taylor expanded in c around 0 84.5%
if -4.1999999999999999e107 < x < -4.79999999999999985e36 or 7.8e6 < x Initial program 91.8%
associate-+l+91.8%
associate-+l+91.8%
fma-def93.1%
fma-def93.1%
fma-def93.1%
Simplified93.1%
Taylor expanded in a around 0 70.3%
Taylor expanded in c around 0 53.9%
if -4.79999999999999985e36 < x < 7.8e6Initial program 94.8%
Taylor expanded in x around 0 85.1%
fma-def86.6%
Simplified86.6%
Taylor expanded in t around 0 62.6%
Final simplification64.1%
(FPCore (x y z t a b c i) :precision binary64 (if (<= x -4.8e+42) (+ (* a b) (+ (* z t) (* x y))) (+ (* c i) (+ (* z t) (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (x <= -4.8e+42) {
tmp = (a * b) + ((z * t) + (x * y));
} else {
tmp = (c * i) + ((z * t) + (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 (x <= (-4.8d+42)) then
tmp = (a * b) + ((z * t) + (x * y))
else
tmp = (c * i) + ((z * t) + (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 (x <= -4.8e+42) {
tmp = (a * b) + ((z * t) + (x * y));
} else {
tmp = (c * i) + ((z * t) + (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if x <= -4.8e+42: tmp = (a * b) + ((z * t) + (x * y)) else: tmp = (c * i) + ((z * t) + (a * b)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -4.8e+42) tmp = Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))); else tmp = Float64(Float64(c * i) + Float64(Float64(z * t) + Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (x <= -4.8e+42) tmp = (a * b) + ((z * t) + (x * y)); else tmp = (c * i) + ((z * t) + (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -4.8e+42], N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+42}:\\
\;\;\;\;a \cdot b + \left(z \cdot t + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(z \cdot t + a \cdot b\right)\\
\end{array}
\end{array}
if x < -4.7999999999999997e42Initial program 90.1%
Taylor expanded in c around 0 85.0%
if -4.7999999999999997e42 < x Initial program 93.8%
Taylor expanded in x around 0 77.5%
Final simplification79.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -6.6e+23) (* a b) (if (<= (* a b) 3.1e+74) (* 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 ((a * b) <= -6.6e+23) {
tmp = a * b;
} else if ((a * b) <= 3.1e+74) {
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 ((a * b) <= (-6.6d+23)) then
tmp = a * b
else if ((a * b) <= 3.1d+74) 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 ((a * b) <= -6.6e+23) {
tmp = a * b;
} else if ((a * b) <= 3.1e+74) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -6.6e+23: tmp = a * b elif (a * b) <= 3.1e+74: tmp = c * i else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -6.6e+23) tmp = Float64(a * b); elseif (Float64(a * b) <= 3.1e+74) 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 ((a * b) <= -6.6e+23) tmp = a * b; elseif ((a * b) <= 3.1e+74) tmp = c * i; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -6.6e+23], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.1e+74], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.6 \cdot 10^{+23}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 3.1 \cdot 10^{+74}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -6.60000000000000059e23 or 3.10000000000000021e74 < (*.f64 a b) Initial program 93.1%
Taylor expanded in a around inf 60.3%
if -6.60000000000000059e23 < (*.f64 a b) < 3.10000000000000021e74Initial program 92.8%
Taylor expanded in c around inf 34.4%
Final simplification47.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= x -5e+22) (+ (* a b) (* 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 <= -5e+22) {
tmp = (a * b) + (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 <= (-5d+22)) then
tmp = (a * b) + (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 <= -5e+22) {
tmp = (a * b) + (x * y);
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if x <= -5e+22: tmp = (a * b) + (x * y) else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -5e+22) tmp = Float64(Float64(a * b) + 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 <= -5e+22) tmp = (a * b) + (x * y); else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -5e+22], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+22}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if x < -4.9999999999999996e22Initial program 89.5%
Taylor expanded in z around 0 85.2%
fma-def86.7%
Simplified86.7%
Taylor expanded in c around 0 79.2%
if -4.9999999999999996e22 < x Initial program 94.1%
Taylor expanded in x around 0 77.3%
fma-def78.4%
Simplified78.4%
Taylor expanded in t around 0 59.5%
Final simplification64.7%
(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 92.9%
Taylor expanded in a around inf 33.2%
Final simplification33.2%
herbie shell --seed 2023196
(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)))