
(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 (fma c i (fma a b (fma x y (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, fma(a, b, fma(x, y, (z * t))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(a, b, fma(x, y, Float64(z * t)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
\end{array}
Initial program 95.7%
+-commutative95.7%
fma-define97.3%
+-commutative97.3%
fma-define98.4%
fma-define98.4%
Simplified98.4%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* x y) (* z t))) (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 = (x * y) + (z * t);
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 = (x * y) + (z * t);
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 = (x * y) + (z * t) 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(x * y) + Float64(z * t)) 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 = (x * y) + (z * t); 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[(x * y), $MachinePrecision] + N[(z * t), $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 := x \cdot y + z \cdot t\\
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%
+-commutative0.0%
fma-define36.4%
+-commutative36.4%
fma-define63.6%
fma-define63.6%
Simplified63.6%
Taylor expanded in c around 0 36.4%
Taylor expanded in a around 0 54.6%
Final simplification98.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* a b) (* c i))))
(if (<= (* c i) -3.7e+126)
t_1
(if (<= (* c i) -2.2e-8)
(+ (* a b) (* z t))
(if (<= (* c i) 1.6e+55) (+ (* x y) (* z t)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (a * b) + (c * i);
double tmp;
if ((c * i) <= -3.7e+126) {
tmp = t_1;
} else if ((c * i) <= -2.2e-8) {
tmp = (a * b) + (z * t);
} else if ((c * i) <= 1.6e+55) {
tmp = (x * y) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (a * b) + (c * i)
if ((c * i) <= (-3.7d+126)) then
tmp = t_1
else if ((c * i) <= (-2.2d-8)) then
tmp = (a * b) + (z * t)
else if ((c * i) <= 1.6d+55) then
tmp = (x * y) + (z * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (a * b) + (c * i);
double tmp;
if ((c * i) <= -3.7e+126) {
tmp = t_1;
} else if ((c * i) <= -2.2e-8) {
tmp = (a * b) + (z * t);
} else if ((c * i) <= 1.6e+55) {
tmp = (x * y) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (a * b) + (c * i) tmp = 0 if (c * i) <= -3.7e+126: tmp = t_1 elif (c * i) <= -2.2e-8: tmp = (a * b) + (z * t) elif (c * i) <= 1.6e+55: tmp = (x * y) + (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(a * b) + Float64(c * i)) tmp = 0.0 if (Float64(c * i) <= -3.7e+126) tmp = t_1; elseif (Float64(c * i) <= -2.2e-8) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (Float64(c * i) <= 1.6e+55) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (a * b) + (c * i); tmp = 0.0; if ((c * i) <= -3.7e+126) tmp = t_1; elseif ((c * i) <= -2.2e-8) tmp = (a * b) + (z * t); elseif ((c * i) <= 1.6e+55) tmp = (x * y) + (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -3.7e+126], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], -2.2e-8], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.6e+55], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + c \cdot i\\
\mathbf{if}\;c \cdot i \leq -3.7 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq -2.2 \cdot 10^{-8}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 1.6 \cdot 10^{+55}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 c i) < -3.6999999999999998e126 or 1.6000000000000001e55 < (*.f64 c i) Initial program 92.1%
associate-+l+92.1%
fma-define92.1%
Simplified92.1%
Taylor expanded in x around inf 84.5%
Taylor expanded in x around 0 79.5%
if -3.6999999999999998e126 < (*.f64 c i) < -2.1999999999999998e-8Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 90.5%
Taylor expanded in t around inf 71.5%
if -2.1999999999999998e-8 < (*.f64 c i) < 1.6000000000000001e55Initial program 97.1%
+-commutative97.1%
fma-define97.1%
+-commutative97.1%
fma-define98.5%
fma-define98.5%
Simplified98.5%
Taylor expanded in c around 0 95.6%
Taylor expanded in a around 0 73.7%
Final simplification75.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -3.2e+128) (not (<= (* c i) 5.5e+145))) (+ (* a b) (* c i)) (+ (* a b) (+ (* x y) (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -3.2e+128) || !((c * i) <= 5.5e+145)) {
tmp = (a * b) + (c * i);
} else {
tmp = (a * b) + ((x * y) + (z * t));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((c * i) <= (-3.2d+128)) .or. (.not. ((c * i) <= 5.5d+145))) then
tmp = (a * b) + (c * i)
else
tmp = (a * b) + ((x * y) + (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -3.2e+128) || !((c * i) <= 5.5e+145)) {
tmp = (a * b) + (c * i);
} else {
tmp = (a * b) + ((x * y) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -3.2e+128) or not ((c * i) <= 5.5e+145): tmp = (a * b) + (c * i) else: tmp = (a * b) + ((x * y) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -3.2e+128) || !(Float64(c * i) <= 5.5e+145)) tmp = Float64(Float64(a * b) + Float64(c * i)); else tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -3.2e+128) || ~(((c * i) <= 5.5e+145))) tmp = (a * b) + (c * i); else tmp = (a * b) + ((x * y) + (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -3.2e+128], N[Not[LessEqual[N[(c * i), $MachinePrecision], 5.5e+145]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.2 \cdot 10^{+128} \lor \neg \left(c \cdot i \leq 5.5 \cdot 10^{+145}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -3.19999999999999986e128 or 5.4999999999999995e145 < (*.f64 c i) Initial program 90.4%
associate-+l+90.4%
fma-define90.4%
Simplified90.4%
Taylor expanded in x around inf 86.6%
Taylor expanded in x around 0 84.0%
if -3.19999999999999986e128 < (*.f64 c i) < 5.4999999999999995e145Initial program 97.8%
+-commutative97.8%
fma-define97.8%
+-commutative97.8%
fma-define98.9%
fma-define98.9%
Simplified98.9%
Taylor expanded in c around 0 92.5%
Final simplification90.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= (* c i) -9e+127)
(+ (* x y) (+ (* a b) (* c i)))
(if (<= (* c i) 4.5e+31) (+ (* a b) t_1) (+ (* c i) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if ((c * i) <= -9e+127) {
tmp = (x * y) + ((a * b) + (c * i));
} else if ((c * i) <= 4.5e+31) {
tmp = (a * b) + t_1;
} else {
tmp = (c * i) + t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) + (z * t)
if ((c * i) <= (-9d+127)) then
tmp = (x * y) + ((a * b) + (c * i))
else if ((c * i) <= 4.5d+31) then
tmp = (a * b) + t_1
else
tmp = (c * i) + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if ((c * i) <= -9e+127) {
tmp = (x * y) + ((a * b) + (c * i));
} else if ((c * i) <= 4.5e+31) {
tmp = (a * b) + t_1;
} else {
tmp = (c * i) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if (c * i) <= -9e+127: tmp = (x * y) + ((a * b) + (c * i)) elif (c * i) <= 4.5e+31: tmp = (a * b) + t_1 else: tmp = (c * i) + t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (Float64(c * i) <= -9e+127) tmp = Float64(Float64(x * y) + Float64(Float64(a * b) + Float64(c * i))); elseif (Float64(c * i) <= 4.5e+31) tmp = Float64(Float64(a * b) + t_1); else tmp = Float64(Float64(c * i) + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (x * y) + (z * t); tmp = 0.0; if ((c * i) <= -9e+127) tmp = (x * y) + ((a * b) + (c * i)); elseif ((c * i) <= 4.5e+31) tmp = (a * b) + t_1; else tmp = (c * i) + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -9e+127], N[(N[(x * y), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 4.5e+31], N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -9 \cdot 10^{+127}:\\
\;\;\;\;x \cdot y + \left(a \cdot b + c \cdot i\right)\\
\mathbf{elif}\;c \cdot i \leq 4.5 \cdot 10^{+31}:\\
\;\;\;\;a \cdot b + t\_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + t\_1\\
\end{array}
\end{array}
if (*.f64 c i) < -9.00000000000000068e127Initial program 92.9%
associate-+l+92.9%
fma-define92.9%
Simplified92.9%
Taylor expanded in x around inf 92.9%
if -9.00000000000000068e127 < (*.f64 c i) < 4.4999999999999996e31Initial program 97.5%
+-commutative97.5%
fma-define97.5%
+-commutative97.5%
fma-define98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in c around 0 94.5%
if 4.4999999999999996e31 < (*.f64 c i) Initial program 92.4%
+-commutative92.4%
fma-define97.0%
+-commutative97.0%
fma-define98.5%
fma-define98.5%
Simplified98.5%
Taylor expanded in a around 0 82.7%
Final simplification91.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= (* c i) -5.5e+124)
(+ (* a b) (* c i))
(if (<= (* c i) 5.6e+31) (+ (* a b) t_1) (+ (* c i) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if ((c * i) <= -5.5e+124) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 5.6e+31) {
tmp = (a * b) + t_1;
} else {
tmp = (c * i) + t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) + (z * t)
if ((c * i) <= (-5.5d+124)) then
tmp = (a * b) + (c * i)
else if ((c * i) <= 5.6d+31) then
tmp = (a * b) + t_1
else
tmp = (c * i) + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if ((c * i) <= -5.5e+124) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 5.6e+31) {
tmp = (a * b) + t_1;
} else {
tmp = (c * i) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if (c * i) <= -5.5e+124: tmp = (a * b) + (c * i) elif (c * i) <= 5.6e+31: tmp = (a * b) + t_1 else: tmp = (c * i) + t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (Float64(c * i) <= -5.5e+124) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(c * i) <= 5.6e+31) tmp = Float64(Float64(a * b) + t_1); else tmp = Float64(Float64(c * i) + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (x * y) + (z * t); tmp = 0.0; if ((c * i) <= -5.5e+124) tmp = (a * b) + (c * i); elseif ((c * i) <= 5.6e+31) tmp = (a * b) + t_1; else tmp = (c * i) + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -5.5e+124], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5.6e+31], N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -5.5 \cdot 10^{+124}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 5.6 \cdot 10^{+31}:\\
\;\;\;\;a \cdot b + t\_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + t\_1\\
\end{array}
\end{array}
if (*.f64 c i) < -5.49999999999999977e124Initial program 92.9%
associate-+l+92.9%
fma-define92.9%
Simplified92.9%
Taylor expanded in x around inf 92.9%
Taylor expanded in x around 0 89.3%
if -5.49999999999999977e124 < (*.f64 c i) < 5.60000000000000034e31Initial program 97.5%
+-commutative97.5%
fma-define97.5%
+-commutative97.5%
fma-define98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in c around 0 94.5%
if 5.60000000000000034e31 < (*.f64 c i) Initial program 92.4%
+-commutative92.4%
fma-define97.0%
+-commutative97.0%
fma-define98.5%
fma-define98.5%
Simplified98.5%
Taylor expanded in a around 0 82.7%
Final simplification90.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -2.6e+126)
(* c i)
(if (<= (* c i) 1.68e-223)
(* a b)
(if (<= (* c i) 3.9e+55) (* z t) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -2.6e+126) {
tmp = c * i;
} else if ((c * i) <= 1.68e-223) {
tmp = a * b;
} else if ((c * i) <= 3.9e+55) {
tmp = z * t;
} else {
tmp = c * i;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((c * i) <= (-2.6d+126)) then
tmp = c * i
else if ((c * i) <= 1.68d-223) then
tmp = a * b
else if ((c * i) <= 3.9d+55) then
tmp = z * t
else
tmp = c * i
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -2.6e+126) {
tmp = c * i;
} else if ((c * i) <= 1.68e-223) {
tmp = a * b;
} else if ((c * i) <= 3.9e+55) {
tmp = z * t;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -2.6e+126: tmp = c * i elif (c * i) <= 1.68e-223: tmp = a * b elif (c * i) <= 3.9e+55: tmp = z * t else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -2.6e+126) tmp = Float64(c * i); elseif (Float64(c * i) <= 1.68e-223) tmp = Float64(a * b); elseif (Float64(c * i) <= 3.9e+55) tmp = Float64(z * t); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -2.6e+126) tmp = c * i; elseif ((c * i) <= 1.68e-223) tmp = a * b; elseif ((c * i) <= 3.9e+55) tmp = z * t; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -2.6e+126], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.68e-223], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 3.9e+55], N[(z * t), $MachinePrecision], N[(c * i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.6 \cdot 10^{+126}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 1.68 \cdot 10^{-223}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 3.9 \cdot 10^{+55}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -2.6e126 or 3.90000000000000027e55 < (*.f64 c i) Initial program 92.1%
+-commutative92.1%
fma-define96.6%
+-commutative96.6%
fma-define97.8%
fma-define97.8%
Simplified97.8%
Taylor expanded in c around inf 65.3%
if -2.6e126 < (*.f64 c i) < 1.68000000000000005e-223Initial program 96.5%
+-commutative96.5%
fma-define96.5%
+-commutative96.5%
fma-define98.2%
fma-define98.2%
Simplified98.2%
Taylor expanded in a around inf 39.2%
if 1.68000000000000005e-223 < (*.f64 c i) < 3.90000000000000027e55Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 96.2%
Taylor expanded in t around inf 63.5%
Taylor expanded in a around 0 48.8%
Final simplification50.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -4.25e-75) (not (<= (* x y) 8.5e+107))) (+ (* x y) (* 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) <= -4.25e-75) || !((x * y) <= 8.5e+107)) {
tmp = (x * y) + (c * i);
} 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) <= (-4.25d-75)) .or. (.not. ((x * y) <= 8.5d+107))) then
tmp = (x * y) + (c * i)
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) <= -4.25e-75) || !((x * y) <= 8.5e+107)) {
tmp = (x * y) + (c * i);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -4.25e-75) or not ((x * y) <= 8.5e+107): tmp = (x * y) + (c * i) 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) <= -4.25e-75) || !(Float64(x * y) <= 8.5e+107)) tmp = Float64(Float64(x * y) + Float64(c * i)); 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) <= -4.25e-75) || ~(((x * y) <= 8.5e+107))) tmp = (x * y) + (c * i); 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], -4.25e-75], N[Not[LessEqual[N[(x * y), $MachinePrecision], 8.5e+107]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4.25 \cdot 10^{-75} \lor \neg \left(x \cdot y \leq 8.5 \cdot 10^{+107}\right):\\
\;\;\;\;x \cdot y + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -4.2500000000000001e-75 or 8.4999999999999999e107 < (*.f64 x y) Initial program 95.1%
+-commutative95.1%
fma-define95.9%
+-commutative95.9%
fma-define97.5%
fma-define97.5%
Simplified97.5%
Taylor expanded in a around 0 85.8%
Taylor expanded in t around 0 70.2%
if -4.2500000000000001e-75 < (*.f64 x y) < 8.4999999999999999e107Initial program 96.3%
+-commutative96.3%
fma-define98.5%
+-commutative98.5%
fma-define99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in c around 0 74.5%
Taylor expanded in t around inf 73.1%
Final simplification71.7%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -2.6e+124) (not (<= (* c i) 2.6e+55))) (+ (* a b) (* 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 (((c * i) <= -2.6e+124) || !((c * i) <= 2.6e+55)) {
tmp = (a * b) + (c * i);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((c * i) <= (-2.6d+124)) .or. (.not. ((c * i) <= 2.6d+55))) then
tmp = (a * b) + (c * i)
else
tmp = (a * b) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -2.6e+124) || !((c * i) <= 2.6e+55)) {
tmp = (a * b) + (c * i);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -2.6e+124) or not ((c * i) <= 2.6e+55): tmp = (a * b) + (c * i) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -2.6e+124) || !(Float64(c * i) <= 2.6e+55)) tmp = Float64(Float64(a * b) + Float64(c * i)); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -2.6e+124) || ~(((c * i) <= 2.6e+55))) tmp = (a * b) + (c * i); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -2.6e+124], N[Not[LessEqual[N[(c * i), $MachinePrecision], 2.6e+55]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.6 \cdot 10^{+124} \lor \neg \left(c \cdot i \leq 2.6 \cdot 10^{+55}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 c i) < -2.6e124 or 2.6e55 < (*.f64 c i) Initial program 92.1%
associate-+l+92.1%
fma-define92.1%
Simplified92.1%
Taylor expanded in x around inf 84.5%
Taylor expanded in x around 0 79.5%
if -2.6e124 < (*.f64 c i) < 2.6e55Initial program 97.6%
+-commutative97.6%
fma-define97.6%
+-commutative97.6%
fma-define98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in c around 0 94.6%
Taylor expanded in t around inf 66.1%
Final simplification70.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -2.1e+238) (not (<= (* x y) 1.3e+220))) (* 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) <= -2.1e+238) || !((x * y) <= 1.3e+220)) {
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) <= (-2.1d+238)) .or. (.not. ((x * y) <= 1.3d+220))) 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) <= -2.1e+238) || !((x * y) <= 1.3e+220)) {
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) <= -2.1e+238) or not ((x * y) <= 1.3e+220): 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) <= -2.1e+238) || !(Float64(x * y) <= 1.3e+220)) 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) <= -2.1e+238) || ~(((x * y) <= 1.3e+220))) 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], -2.1e+238], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.3e+220]], $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 -2.1 \cdot 10^{+238} \lor \neg \left(x \cdot y \leq 1.3 \cdot 10^{+220}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -2.10000000000000007e238 or 1.29999999999999997e220 < (*.f64 x y) Initial program 91.1%
+-commutative91.1%
fma-define92.9%
+-commutative92.9%
fma-define94.6%
fma-define94.6%
Simplified94.6%
Taylor expanded in c around 0 86.0%
Taylor expanded in t around 0 81.0%
Taylor expanded in a around 0 79.3%
if -2.10000000000000007e238 < (*.f64 x y) < 1.29999999999999997e220Initial program 97.0%
associate-+l+97.0%
fma-define97.0%
Simplified97.0%
Taylor expanded in x around inf 67.0%
Taylor expanded in x around 0 57.7%
Final simplification62.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -3.8e+124) (not (<= (* c i) 1.55e+46))) (* c i) (* a b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -3.8e+124) || !((c * i) <= 1.55e+46)) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((c * i) <= (-3.8d+124)) .or. (.not. ((c * i) <= 1.55d+46))) then
tmp = c * i
else
tmp = a * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -3.8e+124) || !((c * i) <= 1.55e+46)) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -3.8e+124) or not ((c * i) <= 1.55e+46): tmp = c * i else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -3.8e+124) || !(Float64(c * i) <= 1.55e+46)) tmp = Float64(c * i); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -3.8e+124) || ~(((c * i) <= 1.55e+46))) tmp = c * i; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -3.8e+124], N[Not[LessEqual[N[(c * i), $MachinePrecision], 1.55e+46]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.8 \cdot 10^{+124} \lor \neg \left(c \cdot i \leq 1.55 \cdot 10^{+46}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -3.7999999999999998e124 or 1.54999999999999988e46 < (*.f64 c i) Initial program 92.4%
+-commutative92.4%
fma-define96.7%
+-commutative96.7%
fma-define97.8%
fma-define97.8%
Simplified97.8%
Taylor expanded in c around inf 63.3%
if -3.7999999999999998e124 < (*.f64 c i) < 1.54999999999999988e46Initial program 97.6%
+-commutative97.6%
fma-define97.6%
+-commutative97.6%
fma-define98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in a around inf 32.6%
Final simplification43.6%
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
def code(x, y, z, t, a, b, c, i): return a * b
function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 95.7%
+-commutative95.7%
fma-define97.3%
+-commutative97.3%
fma-define98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in a around inf 27.9%
herbie shell --seed 2024181
(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)))