
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (fma c i (fma x y (fma z t (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, fma(x, y, fma(z, t, (a * b))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)
\end{array}
Initial program 94.9%
+-commutative94.9%
fma-def96.1%
associate-+l+96.1%
fma-def98.4%
fma-def98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b c i) :precision binary64 (+ (fma y x (fma 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 fma(y, x, fma(z, t, (a * b))) + (c * i);
}
function code(x, y, z, t, a, b, c, i) return Float64(fma(y, x, fma(z, t, Float64(a * b))) + Float64(c * i)) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(y * x + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x, \mathsf{fma}\left(z, t, a \cdot b\right)\right) + c \cdot i
\end{array}
Initial program 94.9%
associate-+l+94.9%
fma-udef94.9%
*-commutative94.9%
fma-def97.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) (+ (* z t) (* x y)))))) (if (<= t_1 INFINITY) t_1 (+ (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) {
double t_1 = (c * i) + ((a * b) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(x, y, (a * b)) + (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 = Float64(fma(x, y, Float64(a * b)) + 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[(N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision] + 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(x, y, a \cdot b\right) + 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%
+-commutative0.0%
fma-def23.1%
associate-+l+23.1%
fma-def69.2%
fma-def69.2%
Simplified69.2%
fma-udef23.1%
fma-udef23.1%
associate-+l+23.1%
+-commutative23.1%
associate-+r+23.1%
Applied egg-rr23.1%
fma-udef0.0%
associate-+r+0.0%
+-commutative0.0%
fma-def30.8%
*-commutative30.8%
Applied egg-rr30.8%
Taylor expanded in c around 0 23.1%
+-commutative23.1%
fma-udef53.8%
Simplified53.8%
Final simplification97.6%
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (* 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 ((c * i) + fma(x, y, (a * b))) + (z * t);
}
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(c * i) + fma(x, y, Float64(a * b))) + Float64(z * t)) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(c * i), $MachinePrecision] + N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(c \cdot i + \mathsf{fma}\left(x, y, a \cdot b\right)\right) + z \cdot t
\end{array}
Initial program 94.9%
+-commutative94.9%
fma-def96.1%
associate-+l+96.1%
fma-def98.4%
fma-def98.4%
Simplified98.4%
fma-udef96.1%
fma-udef96.1%
associate-+l+96.1%
+-commutative96.1%
associate-+r+96.1%
Applied egg-rr96.1%
fma-udef94.9%
associate-+r+94.9%
+-commutative94.9%
fma-def96.5%
*-commutative96.5%
Applied egg-rr96.5%
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) (* z t))))
(if (<= (* a b) -3.5e+161)
(* a b)
(if (<= (* a b) -1.12e-45)
t_1
(if (<= (* a b) -4.9e-223)
t_2
(if (<= (* a b) -2.3e-298)
t_1
(if (<= (* a b) 2.3e-239)
t_2
(if (<= (* a b) 2.9e-130)
t_1
(if (<= (* a b) 8e+165) t_2 (* a b))))))))))
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) + (z * t);
double tmp;
if ((a * b) <= -3.5e+161) {
tmp = a * b;
} else if ((a * b) <= -1.12e-45) {
tmp = t_1;
} else if ((a * b) <= -4.9e-223) {
tmp = t_2;
} else if ((a * b) <= -2.3e-298) {
tmp = t_1;
} else if ((a * b) <= 2.3e-239) {
tmp = t_2;
} else if ((a * b) <= 2.9e-130) {
tmp = t_1;
} else if ((a * b) <= 8e+165) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) + (x * y)
t_2 = (c * i) + (z * t)
if ((a * b) <= (-3.5d+161)) then
tmp = a * b
else if ((a * b) <= (-1.12d-45)) then
tmp = t_1
else if ((a * b) <= (-4.9d-223)) then
tmp = t_2
else if ((a * b) <= (-2.3d-298)) then
tmp = t_1
else if ((a * b) <= 2.3d-239) then
tmp = t_2
else if ((a * b) <= 2.9d-130) then
tmp = t_1
else if ((a * b) <= 8d+165) then
tmp = t_2
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 t_1 = (z * t) + (x * y);
double t_2 = (c * i) + (z * t);
double tmp;
if ((a * b) <= -3.5e+161) {
tmp = a * b;
} else if ((a * b) <= -1.12e-45) {
tmp = t_1;
} else if ((a * b) <= -4.9e-223) {
tmp = t_2;
} else if ((a * b) <= -2.3e-298) {
tmp = t_1;
} else if ((a * b) <= 2.3e-239) {
tmp = t_2;
} else if ((a * b) <= 2.9e-130) {
tmp = t_1;
} else if ((a * b) <= 8e+165) {
tmp = t_2;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (z * t) + (x * y) t_2 = (c * i) + (z * t) tmp = 0 if (a * b) <= -3.5e+161: tmp = a * b elif (a * b) <= -1.12e-45: tmp = t_1 elif (a * b) <= -4.9e-223: tmp = t_2 elif (a * b) <= -2.3e-298: tmp = t_1 elif (a * b) <= 2.3e-239: tmp = t_2 elif (a * b) <= 2.9e-130: tmp = t_1 elif (a * b) <= 8e+165: tmp = t_2 else: tmp = a * b 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(z * t)) tmp = 0.0 if (Float64(a * b) <= -3.5e+161) tmp = Float64(a * b); elseif (Float64(a * b) <= -1.12e-45) tmp = t_1; elseif (Float64(a * b) <= -4.9e-223) tmp = t_2; elseif (Float64(a * b) <= -2.3e-298) tmp = t_1; elseif (Float64(a * b) <= 2.3e-239) tmp = t_2; elseif (Float64(a * b) <= 2.9e-130) tmp = t_1; elseif (Float64(a * b) <= 8e+165) tmp = t_2; else tmp = Float64(a * b); 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) + (z * t); tmp = 0.0; if ((a * b) <= -3.5e+161) tmp = a * b; elseif ((a * b) <= -1.12e-45) tmp = t_1; elseif ((a * b) <= -4.9e-223) tmp = t_2; elseif ((a * b) <= -2.3e-298) tmp = t_1; elseif ((a * b) <= 2.3e-239) tmp = t_2; elseif ((a * b) <= 2.9e-130) tmp = t_1; elseif ((a * b) <= 8e+165) tmp = t_2; else tmp = a * b; 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[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -3.5e+161], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.12e-45], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], -4.9e-223], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -2.3e-298], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2.3e-239], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 2.9e-130], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 8e+165], t$95$2, N[(a * b), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t + x \cdot y\\
t_2 := c \cdot i + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -3.5 \cdot 10^{+161}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.12 \cdot 10^{-45}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq -4.9 \cdot 10^{-223}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq -2.3 \cdot 10^{-298}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 2.3 \cdot 10^{-239}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 2.9 \cdot 10^{-130}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 8 \cdot 10^{+165}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -3.49999999999999988e161 or 7.9999999999999992e165 < (*.f64 a b) Initial program 86.6%
Taylor expanded in a around inf 83.8%
if -3.49999999999999988e161 < (*.f64 a b) < -1.1199999999999999e-45 or -4.9e-223 < (*.f64 a b) < -2.3000000000000001e-298 or 2.2999999999999999e-239 < (*.f64 a b) < 2.9e-130Initial program 98.7%
associate-+l+98.7%
fma-udef98.7%
*-commutative98.7%
fma-def98.7%
Applied egg-rr98.7%
Taylor expanded in a around 0 91.0%
Taylor expanded in c around 0 76.0%
if -1.1199999999999999e-45 < (*.f64 a b) < -4.9e-223 or -2.3000000000000001e-298 < (*.f64 a b) < 2.2999999999999999e-239 or 2.9e-130 < (*.f64 a b) < 7.9999999999999992e165Initial program 96.7%
associate-+l+96.7%
fma-udef96.7%
*-commutative96.7%
fma-def97.5%
Applied egg-rr97.5%
Taylor expanded in a around 0 87.8%
Taylor expanded in t around inf 71.2%
Final simplification75.6%
(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 (* 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) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = a * b;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + ((a * b) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + ((a * b) + ((z * t) + (x * y))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = 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(z * t) + Float64(x * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (c * i) + ((a * b) + ((z * t) + (x * y))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(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), $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}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
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 inf 39.4%
Final simplification96.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -4.5e+80)
(* c i)
(if (<= (* c i) -2.5e-62)
(* a b)
(if (<= (* c i) -1.08e-275)
(* x y)
(if (<= (* c i) 8.5e-111)
(* z t)
(if (<= (* c i) 2.3e+25) (* 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) <= -4.5e+80) {
tmp = c * i;
} else if ((c * i) <= -2.5e-62) {
tmp = a * b;
} else if ((c * i) <= -1.08e-275) {
tmp = x * y;
} else if ((c * i) <= 8.5e-111) {
tmp = z * t;
} else if ((c * i) <= 2.3e+25) {
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 ((c * i) <= (-4.5d+80)) then
tmp = c * i
else if ((c * i) <= (-2.5d-62)) then
tmp = a * b
else if ((c * i) <= (-1.08d-275)) then
tmp = x * y
else if ((c * i) <= 8.5d-111) then
tmp = z * t
else if ((c * i) <= 2.3d+25) 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 ((c * i) <= -4.5e+80) {
tmp = c * i;
} else if ((c * i) <= -2.5e-62) {
tmp = a * b;
} else if ((c * i) <= -1.08e-275) {
tmp = x * y;
} else if ((c * i) <= 8.5e-111) {
tmp = z * t;
} else if ((c * i) <= 2.3e+25) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -4.5e+80: tmp = c * i elif (c * i) <= -2.5e-62: tmp = a * b elif (c * i) <= -1.08e-275: tmp = x * y elif (c * i) <= 8.5e-111: tmp = z * t elif (c * i) <= 2.3e+25: tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -4.5e+80) tmp = Float64(c * i); elseif (Float64(c * i) <= -2.5e-62) tmp = Float64(a * b); elseif (Float64(c * i) <= -1.08e-275) tmp = Float64(x * y); elseif (Float64(c * i) <= 8.5e-111) tmp = Float64(z * t); elseif (Float64(c * i) <= 2.3e+25) 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 ((c * i) <= -4.5e+80) tmp = c * i; elseif ((c * i) <= -2.5e-62) tmp = a * b; elseif ((c * i) <= -1.08e-275) tmp = x * y; elseif ((c * i) <= 8.5e-111) tmp = z * t; elseif ((c * i) <= 2.3e+25) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -4.5e+80], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -2.5e-62], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -1.08e-275], N[(x * y), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 8.5e-111], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.3e+25], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -4.5 \cdot 10^{+80}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -2.5 \cdot 10^{-62}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq -1.08 \cdot 10^{-275}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 8.5 \cdot 10^{-111}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 2.3 \cdot 10^{+25}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -4.50000000000000007e80 or 2.2999999999999998e25 < (*.f64 c i) Initial program 91.7%
Taylor expanded in c around inf 60.6%
if -4.50000000000000007e80 < (*.f64 c i) < -2.5000000000000001e-62 or 8.5000000000000003e-111 < (*.f64 c i) < 2.2999999999999998e25Initial program 95.4%
Taylor expanded in a around inf 51.5%
if -2.5000000000000001e-62 < (*.f64 c i) < -1.07999999999999994e-275Initial program 100.0%
Taylor expanded in x around inf 54.6%
if -1.07999999999999994e-275 < (*.f64 c i) < 8.5000000000000003e-111Initial program 97.3%
Taylor expanded in z around inf 46.4%
Final simplification54.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -2.6e+81)
(* c i)
(if (<= (* c i) -2.3e-85)
(* a b)
(if (<= (* c i) 5.8e-122)
(* z t)
(if (<= (* c i) 2.6e+25) (* 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) <= -2.6e+81) {
tmp = c * i;
} else if ((c * i) <= -2.3e-85) {
tmp = a * b;
} else if ((c * i) <= 5.8e-122) {
tmp = z * t;
} else if ((c * i) <= 2.6e+25) {
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 ((c * i) <= (-2.6d+81)) then
tmp = c * i
else if ((c * i) <= (-2.3d-85)) then
tmp = a * b
else if ((c * i) <= 5.8d-122) then
tmp = z * t
else if ((c * i) <= 2.6d+25) 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 ((c * i) <= -2.6e+81) {
tmp = c * i;
} else if ((c * i) <= -2.3e-85) {
tmp = a * b;
} else if ((c * i) <= 5.8e-122) {
tmp = z * t;
} else if ((c * i) <= 2.6e+25) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -2.6e+81: tmp = c * i elif (c * i) <= -2.3e-85: tmp = a * b elif (c * i) <= 5.8e-122: tmp = z * t elif (c * i) <= 2.6e+25: tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -2.6e+81) tmp = Float64(c * i); elseif (Float64(c * i) <= -2.3e-85) tmp = Float64(a * b); elseif (Float64(c * i) <= 5.8e-122) tmp = Float64(z * t); elseif (Float64(c * i) <= 2.6e+25) 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 ((c * i) <= -2.6e+81) tmp = c * i; elseif ((c * i) <= -2.3e-85) tmp = a * b; elseif ((c * i) <= 5.8e-122) tmp = z * t; elseif ((c * i) <= 2.6e+25) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -2.6e+81], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -2.3e-85], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5.8e-122], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.6e+25], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.6 \cdot 10^{+81}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -2.3 \cdot 10^{-85}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 5.8 \cdot 10^{-122}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 2.6 \cdot 10^{+25}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -2.59999999999999992e81 or 2.5999999999999998e25 < (*.f64 c i) Initial program 91.7%
Taylor expanded in c around inf 60.6%
if -2.59999999999999992e81 < (*.f64 c i) < -2.3e-85 or 5.8000000000000005e-122 < (*.f64 c i) < 2.5999999999999998e25Initial program 96.3%
Taylor expanded in a around inf 48.9%
if -2.3e-85 < (*.f64 c i) < 5.8000000000000005e-122Initial program 97.8%
Taylor expanded in z around inf 43.8%
Final simplification52.0%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -4.1e+161) (not (<= (* a b) 1.5e+165))) (* a b) (+ (* c i) (+ (* 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 (((a * b) <= -4.1e+161) || !((a * b) <= 1.5e+165)) {
tmp = a * b;
} else {
tmp = (c * i) + ((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 (((a * b) <= (-4.1d+161)) .or. (.not. ((a * b) <= 1.5d+165))) then
tmp = a * b
else
tmp = (c * i) + ((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 (((a * b) <= -4.1e+161) || !((a * b) <= 1.5e+165)) {
tmp = a * b;
} else {
tmp = (c * i) + ((z * t) + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -4.1e+161) or not ((a * b) <= 1.5e+165): tmp = a * b else: tmp = (c * i) + ((z * t) + (x * y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -4.1e+161) || !(Float64(a * b) <= 1.5e+165)) tmp = Float64(a * b); else tmp = Float64(Float64(c * i) + 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 (((a * b) <= -4.1e+161) || ~(((a * b) <= 1.5e+165))) tmp = a * b; else tmp = (c * i) + ((z * t) + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -4.1e+161], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.5e+165]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.1 \cdot 10^{+161} \lor \neg \left(a \cdot b \leq 1.5 \cdot 10^{+165}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(z \cdot t + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -4.1000000000000001e161 or 1.49999999999999995e165 < (*.f64 a b) Initial program 86.6%
Taylor expanded in a around inf 83.8%
if -4.1000000000000001e161 < (*.f64 a b) < 1.49999999999999995e165Initial program 97.4%
Taylor expanded in a around 0 89.1%
Final simplification87.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -4.2e+154) (not (<= (* a b) 1.85e+166))) (* a b) (+ (* 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 (((a * b) <= -4.2e+154) || !((a * b) <= 1.85e+166)) {
tmp = a * b;
} else {
tmp = (c * i) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((a * b) <= (-4.2d+154)) .or. (.not. ((a * b) <= 1.85d+166))) then
tmp = a * b
else
tmp = (c * i) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -4.2e+154) || !((a * b) <= 1.85e+166)) {
tmp = a * b;
} else {
tmp = (c * i) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -4.2e+154) or not ((a * b) <= 1.85e+166): tmp = a * b else: tmp = (c * i) + (z * t) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -4.2e+154) || !(Float64(a * b) <= 1.85e+166)) tmp = Float64(a * b); else tmp = Float64(Float64(c * i) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((a * b) <= -4.2e+154) || ~(((a * b) <= 1.85e+166))) tmp = a * b; else tmp = (c * i) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -4.2e+154], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.85e+166]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.2 \cdot 10^{+154} \lor \neg \left(a \cdot b \leq 1.85 \cdot 10^{+166}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -4.19999999999999989e154 or 1.85000000000000011e166 < (*.f64 a b) Initial program 87.1%
Taylor expanded in a around inf 81.2%
if -4.19999999999999989e154 < (*.f64 a b) < 1.85000000000000011e166Initial program 97.4%
associate-+l+97.4%
fma-udef97.4%
*-commutative97.4%
fma-def97.9%
Applied egg-rr97.9%
Taylor expanded in a around 0 89.0%
Taylor expanded in t around inf 64.8%
Final simplification68.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -3.2e+92) (+ (* c i) (* z t)) (if (<= (* c i) 5e+74) (+ (* z t) (* x y)) (+ (* c i) (* 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) <= -3.2e+92) {
tmp = (c * i) + (z * t);
} else if ((c * i) <= 5e+74) {
tmp = (z * t) + (x * y);
} else {
tmp = (c * i) + (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) <= (-3.2d+92)) then
tmp = (c * i) + (z * t)
else if ((c * i) <= 5d+74) then
tmp = (z * t) + (x * y)
else
tmp = (c * i) + (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) <= -3.2e+92) {
tmp = (c * i) + (z * t);
} else if ((c * i) <= 5e+74) {
tmp = (z * t) + (x * y);
} else {
tmp = (c * i) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -3.2e+92: tmp = (c * i) + (z * t) elif (c * i) <= 5e+74: tmp = (z * t) + (x * y) else: tmp = (c * i) + (x * y) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -3.2e+92) tmp = Float64(Float64(c * i) + Float64(z * t)); elseif (Float64(c * i) <= 5e+74) tmp = Float64(Float64(z * t) + Float64(x * y)); else tmp = Float64(Float64(c * i) + 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) <= -3.2e+92) tmp = (c * i) + (z * t); elseif ((c * i) <= 5e+74) tmp = (z * t) + (x * y); else tmp = (c * i) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -3.2e+92], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5e+74], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.2 \cdot 10^{+92}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+74}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + x \cdot y\\
\end{array}
\end{array}
if (*.f64 c i) < -3.20000000000000025e92Initial program 87.5%
associate-+l+87.5%
fma-udef87.5%
*-commutative87.5%
fma-def91.6%
Applied egg-rr91.6%
Taylor expanded in a around 0 73.4%
Taylor expanded in t around inf 71.7%
if -3.20000000000000025e92 < (*.f64 c i) < 4.99999999999999963e74Initial program 97.5%
associate-+l+97.5%
fma-udef97.5%
*-commutative97.5%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in a around 0 67.6%
Taylor expanded in c around 0 63.9%
if 4.99999999999999963e74 < (*.f64 c i) Initial program 93.9%
associate-+l+93.9%
fma-udef93.9%
*-commutative93.9%
fma-def93.9%
Applied egg-rr93.9%
Taylor expanded in a around 0 81.8%
Taylor expanded in t around 0 81.8%
Final simplification68.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -1.1e+81) (not (<= (* c i) 4.8e+29))) (* 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) <= -1.1e+81) || !((c * i) <= 4.8e+29)) {
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) <= (-1.1d+81)) .or. (.not. ((c * i) <= 4.8d+29))) 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) <= -1.1e+81) || !((c * i) <= 4.8e+29)) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -1.1e+81) or not ((c * i) <= 4.8e+29): 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) <= -1.1e+81) || !(Float64(c * i) <= 4.8e+29)) 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) <= -1.1e+81) || ~(((c * i) <= 4.8e+29))) 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], -1.1e+81], N[Not[LessEqual[N[(c * i), $MachinePrecision], 4.8e+29]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.1 \cdot 10^{+81} \lor \neg \left(c \cdot i \leq 4.8 \cdot 10^{+29}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -1.09999999999999993e81 or 4.8000000000000002e29 < (*.f64 c i) Initial program 91.7%
Taylor expanded in c around inf 60.6%
if -1.09999999999999993e81 < (*.f64 c i) < 4.8000000000000002e29Initial program 97.3%
Taylor expanded in a around inf 37.1%
Final simplification47.1%
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
def code(x, y, z, t, a, b, c, i): return a * b
function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 94.9%
Taylor expanded in a around inf 28.0%
Final simplification28.0%
herbie shell --seed 2023332
(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)))