
(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 94.9%
+-commutative94.9%
fma-define95.7%
+-commutative95.7%
fma-define97.6%
fma-define98.0%
Simplified98.0%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t)))))) (if (<= t_1 INFINITY) t_1 (* z (+ (+ t (* a (/ b z))) (* c (/ i z)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = z * ((t + (a * (b / z))) + (c * (i / z)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = z * ((t + (a * (b / z))) + (c * (i / z)));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + ((a * b) + ((x * y) + (z * t))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = z * ((t + (a * (b / z))) + (c * (i / z))) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(z * Float64(Float64(t + Float64(a * Float64(b / z))) + Float64(c * Float64(i / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (c * i) + ((a * b) + ((x * y) + (z * t))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = z * ((t + (a * (b / z))) + (c * (i / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(N[(t + N[(a * N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * N[(i / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(t + a \cdot \frac{b}{z}\right) + c \cdot \frac{i}{z}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
+-commutative0.0%
fma-define15.4%
+-commutative15.4%
fma-define53.8%
fma-define61.5%
Simplified61.5%
Taylor expanded in z around inf 23.1%
Taylor expanded in x around 0 46.2%
associate-+r+46.2%
associate-*r/53.8%
associate-*r/61.5%
Simplified61.5%
Final simplification98.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* a b) (+ (* c i) (* z t)))))
(if (<= (* c i) -2e+123)
t_1
(if (<= (* c i) 5e+21)
(+ (* a b) (+ (* x y) (* z t)))
(if (<= (* c i) 2e+185) t_1 (+ (* x y) (* c i)))))))
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) + (z * t));
double tmp;
if ((c * i) <= -2e+123) {
tmp = t_1;
} else if ((c * i) <= 5e+21) {
tmp = (a * b) + ((x * y) + (z * t));
} else if ((c * i) <= 2e+185) {
tmp = t_1;
} else {
tmp = (x * y) + (c * i);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (a * b) + ((c * i) + (z * t))
if ((c * i) <= (-2d+123)) then
tmp = t_1
else if ((c * i) <= 5d+21) then
tmp = (a * b) + ((x * y) + (z * t))
else if ((c * i) <= 2d+185) then
tmp = t_1
else
tmp = (x * y) + (c * i)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (a * b) + ((c * i) + (z * t));
double tmp;
if ((c * i) <= -2e+123) {
tmp = t_1;
} else if ((c * i) <= 5e+21) {
tmp = (a * b) + ((x * y) + (z * t));
} else if ((c * i) <= 2e+185) {
tmp = t_1;
} else {
tmp = (x * y) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (a * b) + ((c * i) + (z * t)) tmp = 0 if (c * i) <= -2e+123: tmp = t_1 elif (c * i) <= 5e+21: tmp = (a * b) + ((x * y) + (z * t)) elif (c * i) <= 2e+185: tmp = t_1 else: tmp = (x * y) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(a * b) + Float64(Float64(c * i) + Float64(z * t))) tmp = 0.0 if (Float64(c * i) <= -2e+123) tmp = t_1; elseif (Float64(c * i) <= 5e+21) tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); elseif (Float64(c * i) <= 2e+185) tmp = t_1; else tmp = Float64(Float64(x * y) + Float64(c * i)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (a * b) + ((c * i) + (z * t)); tmp = 0.0; if ((c * i) <= -2e+123) tmp = t_1; elseif ((c * i) <= 5e+21) tmp = (a * b) + ((x * y) + (z * t)); elseif ((c * i) <= 2e+185) tmp = t_1; else tmp = (x * y) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -2e+123], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 5e+21], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2e+185], t$95$1, N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + \left(c \cdot i + z \cdot t\right)\\
\mathbf{if}\;c \cdot i \leq -2 \cdot 10^{+123}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+21}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+185}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -1.99999999999999996e123 or 5e21 < (*.f64 c i) < 2e185Initial program 93.8%
+-commutative93.8%
fma-define95.0%
+-commutative95.0%
fma-define96.3%
fma-define97.5%
Simplified97.5%
Taylor expanded in x around 0 88.9%
if -1.99999999999999996e123 < (*.f64 c i) < 5e21Initial program 96.5%
+-commutative96.5%
fma-define96.5%
+-commutative96.5%
fma-define99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in c around 0 93.6%
if 2e185 < (*.f64 c i) Initial program 90.3%
+-commutative90.3%
fma-define93.5%
+-commutative93.5%
fma-define93.5%
fma-define93.5%
Simplified93.5%
Taylor expanded in a around 0 90.3%
Taylor expanded in t around 0 96.8%
Final simplification92.5%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -1e+86)
(+ (* x y) (* c i))
(if (<= (* c i) 1e-119)
(+ (* x y) (* a b))
(if (<= (* c i) 5e+93) (+ (* x y) (* z t)) (+ (* a b) (* c i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1e+86) {
tmp = (x * y) + (c * i);
} else if ((c * i) <= 1e-119) {
tmp = (x * y) + (a * b);
} else if ((c * i) <= 5e+93) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((c * i) <= (-1d+86)) then
tmp = (x * y) + (c * i)
else if ((c * i) <= 1d-119) then
tmp = (x * y) + (a * b)
else if ((c * i) <= 5d+93) then
tmp = (x * y) + (z * t)
else
tmp = (a * b) + (c * i)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1e+86) {
tmp = (x * y) + (c * i);
} else if ((c * i) <= 1e-119) {
tmp = (x * y) + (a * b);
} else if ((c * i) <= 5e+93) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -1e+86: tmp = (x * y) + (c * i) elif (c * i) <= 1e-119: tmp = (x * y) + (a * b) elif (c * i) <= 5e+93: tmp = (x * y) + (z * t) else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1e+86) tmp = Float64(Float64(x * y) + Float64(c * i)); elseif (Float64(c * i) <= 1e-119) tmp = Float64(Float64(x * y) + Float64(a * b)); elseif (Float64(c * i) <= 5e+93) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(Float64(a * b) + Float64(c * i)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -1e+86) tmp = (x * y) + (c * i); elseif ((c * i) <= 1e-119) tmp = (x * y) + (a * b); elseif ((c * i) <= 5e+93) tmp = (x * y) + (z * t); else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1e+86], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1e-119], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5e+93], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+86}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 10^{-119}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+93}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -1e86Initial program 93.1%
+-commutative93.1%
fma-define94.8%
+-commutative94.8%
fma-define96.6%
fma-define98.3%
Simplified98.3%
Taylor expanded in a around 0 91.0%
Taylor expanded in t around 0 79.5%
if -1e86 < (*.f64 c i) < 1.00000000000000001e-119Initial program 97.3%
+-commutative97.3%
fma-define97.3%
+-commutative97.3%
fma-define99.1%
fma-define99.1%
Simplified99.1%
Taylor expanded in c around 0 95.6%
Taylor expanded in t around 0 70.4%
if 1.00000000000000001e-119 < (*.f64 c i) < 5.0000000000000001e93Initial program 94.6%
+-commutative94.6%
fma-define94.6%
+-commutative94.6%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 85.7%
Taylor expanded in a around 0 75.1%
if 5.0000000000000001e93 < (*.f64 c i) Initial program 92.0%
+-commutative92.0%
fma-define94.0%
+-commutative94.0%
fma-define94.0%
fma-define94.0%
Simplified94.0%
Taylor expanded in x around 0 82.1%
Taylor expanded in c around inf 84.1%
Final simplification75.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= (* a b) -4e+197)
(+ (* x y) (* a b))
(if (<= (* a b) 1e+60) (+ (* c i) t_1) (+ (* a b) 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 ((a * b) <= -4e+197) {
tmp = (x * y) + (a * b);
} else if ((a * b) <= 1e+60) {
tmp = (c * i) + t_1;
} else {
tmp = (a * b) + 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 ((a * b) <= (-4d+197)) then
tmp = (x * y) + (a * b)
else if ((a * b) <= 1d+60) then
tmp = (c * i) + t_1
else
tmp = (a * b) + 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 ((a * b) <= -4e+197) {
tmp = (x * y) + (a * b);
} else if ((a * b) <= 1e+60) {
tmp = (c * i) + t_1;
} else {
tmp = (a * b) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if (a * b) <= -4e+197: tmp = (x * y) + (a * b) elif (a * b) <= 1e+60: tmp = (c * i) + t_1 else: tmp = (a * b) + 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(a * b) <= -4e+197) tmp = Float64(Float64(x * y) + Float64(a * b)); elseif (Float64(a * b) <= 1e+60) tmp = Float64(Float64(c * i) + t_1); else tmp = Float64(Float64(a * b) + 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 ((a * b) <= -4e+197) tmp = (x * y) + (a * b); elseif ((a * b) <= 1e+60) tmp = (c * i) + t_1; else tmp = (a * b) + 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[(a * b), $MachinePrecision], -4e+197], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+60], N[(N[(c * i), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+197}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 10^{+60}:\\
\;\;\;\;c \cdot i + t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -3.9999999999999998e197Initial program 88.5%
+-commutative88.5%
fma-define88.5%
+-commutative88.5%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 87.4%
Taylor expanded in t around 0 87.4%
if -3.9999999999999998e197 < (*.f64 a b) < 9.9999999999999995e59Initial program 97.2%
+-commutative97.2%
fma-define97.8%
+-commutative97.8%
fma-define97.8%
fma-define98.3%
Simplified98.3%
Taylor expanded in a around 0 92.9%
if 9.9999999999999995e59 < (*.f64 a b) Initial program 89.6%
+-commutative89.6%
fma-define91.6%
+-commutative91.6%
fma-define95.8%
fma-define95.8%
Simplified95.8%
Taylor expanded in c around 0 89.1%
Final simplification91.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -2e+238)
(+ (* x y) (* z t))
(if (<= (* x y) 5e+96)
(+ (* a b) (+ (* c i) (* z t)))
(+ (* 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 ((x * y) <= -2e+238) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 5e+96) {
tmp = (a * b) + ((c * i) + (z * t));
} else {
tmp = (x * y) + (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) <= (-2d+238)) then
tmp = (x * y) + (z * t)
else if ((x * y) <= 5d+96) then
tmp = (a * b) + ((c * i) + (z * t))
else
tmp = (x * y) + (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) <= -2e+238) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 5e+96) {
tmp = (a * b) + ((c * i) + (z * t));
} else {
tmp = (x * y) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -2e+238: tmp = (x * y) + (z * t) elif (x * y) <= 5e+96: tmp = (a * b) + ((c * i) + (z * t)) else: tmp = (x * y) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -2e+238) tmp = Float64(Float64(x * y) + Float64(z * t)); elseif (Float64(x * y) <= 5e+96) tmp = Float64(Float64(a * b) + Float64(Float64(c * i) + Float64(z * t))); else tmp = Float64(Float64(x * y) + 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) <= -2e+238) tmp = (x * y) + (z * t); elseif ((x * y) <= 5e+96) tmp = (a * b) + ((c * i) + (z * t)); else tmp = (x * y) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+238], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+96], N[(N[(a * b), $MachinePrecision] + N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+238}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+96}:\\
\;\;\;\;a \cdot b + \left(c \cdot i + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e238Initial program 80.0%
+-commutative80.0%
fma-define84.0%
+-commutative84.0%
fma-define92.0%
fma-define96.0%
Simplified96.0%
Taylor expanded in c around 0 84.0%
Taylor expanded in a around 0 84.0%
if -2.0000000000000001e238 < (*.f64 x y) < 5.0000000000000004e96Initial program 97.8%
+-commutative97.8%
fma-define98.3%
+-commutative98.3%
fma-define98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in x around 0 87.7%
if 5.0000000000000004e96 < (*.f64 x y) Initial program 91.5%
+-commutative91.5%
fma-define91.5%
+-commutative91.5%
fma-define97.9%
fma-define97.9%
Simplified97.9%
Taylor expanded in a around 0 89.6%
Taylor expanded in t around 0 89.6%
Final simplification87.7%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -3.8e+196)
(* a b)
(if (<= (* a b) 8.8e-306)
(* c i)
(if (<= (* a b) 9e+171) (* 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) <= -3.8e+196) {
tmp = a * b;
} else if ((a * b) <= 8.8e-306) {
tmp = c * i;
} else if ((a * b) <= 9e+171) {
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) <= (-3.8d+196)) then
tmp = a * b
else if ((a * b) <= 8.8d-306) then
tmp = c * i
else if ((a * b) <= 9d+171) 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) <= -3.8e+196) {
tmp = a * b;
} else if ((a * b) <= 8.8e-306) {
tmp = c * i;
} else if ((a * b) <= 9e+171) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -3.8e+196: tmp = a * b elif (a * b) <= 8.8e-306: tmp = c * i elif (a * b) <= 9e+171: 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) <= -3.8e+196) tmp = Float64(a * b); elseif (Float64(a * b) <= 8.8e-306) tmp = Float64(c * i); elseif (Float64(a * b) <= 9e+171) 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) <= -3.8e+196) tmp = a * b; elseif ((a * b) <= 8.8e-306) tmp = c * i; elseif ((a * b) <= 9e+171) 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], -3.8e+196], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8.8e-306], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 9e+171], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3.8 \cdot 10^{+196}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 8.8 \cdot 10^{-306}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 9 \cdot 10^{+171}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -3.8000000000000001e196 or 8.99999999999999937e171 < (*.f64 a b) Initial program 86.6%
+-commutative86.6%
fma-define88.3%
+-commutative88.3%
fma-define96.6%
fma-define96.6%
Simplified96.6%
Taylor expanded in a around inf 83.6%
if -3.8000000000000001e196 < (*.f64 a b) < 8.80000000000000062e-306Initial program 96.6%
+-commutative96.6%
fma-define97.4%
+-commutative97.4%
fma-define97.4%
fma-define98.3%
Simplified98.3%
Taylor expanded in c around inf 49.4%
if 8.80000000000000062e-306 < (*.f64 a b) < 8.99999999999999937e171Initial program 98.7%
+-commutative98.7%
fma-define98.7%
+-commutative98.7%
fma-define98.7%
fma-define98.7%
Simplified98.7%
Taylor expanded in c around 0 78.3%
Taylor expanded in t around 0 54.5%
Taylor expanded in a around 0 48.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -3e+196) (not (<= (* a b) 2.05e+130))) (+ (* x y) (* 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 (((a * b) <= -3e+196) || !((a * b) <= 2.05e+130)) {
tmp = (x * y) + (a * b);
} else {
tmp = (x * y) + (c * i);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((a * b) <= (-3d+196)) .or. (.not. ((a * b) <= 2.05d+130))) then
tmp = (x * y) + (a * b)
else
tmp = (x * y) + (c * i)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -3e+196) || !((a * b) <= 2.05e+130)) {
tmp = (x * y) + (a * b);
} else {
tmp = (x * y) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -3e+196) or not ((a * b) <= 2.05e+130): tmp = (x * y) + (a * b) else: tmp = (x * y) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -3e+196) || !(Float64(a * b) <= 2.05e+130)) tmp = Float64(Float64(x * y) + Float64(a * b)); else tmp = Float64(Float64(x * y) + Float64(c * i)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((a * b) <= -3e+196) || ~(((a * b) <= 2.05e+130))) tmp = (x * y) + (a * b); else tmp = (x * y) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -3e+196], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.05e+130]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3 \cdot 10^{+196} \lor \neg \left(a \cdot b \leq 2.05 \cdot 10^{+130}\right):\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\end{array}
\end{array}
if (*.f64 a b) < -2.9999999999999999e196 or 2.04999999999999989e130 < (*.f64 a b) Initial program 87.7%
+-commutative87.7%
fma-define89.2%
+-commutative89.2%
fma-define96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in c around 0 88.4%
Taylor expanded in t around 0 87.0%
if -2.9999999999999999e196 < (*.f64 a b) < 2.04999999999999989e130Initial program 97.4%
+-commutative97.4%
fma-define97.9%
+-commutative97.9%
fma-define97.9%
fma-define98.4%
Simplified98.4%
Taylor expanded in a around 0 92.7%
Taylor expanded in t around 0 69.2%
Final simplification73.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -6e+118) (not (<= (* c i) 1.45e+22))) (+ (* a b) (* c i)) (+ (* 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 (((c * i) <= -6e+118) || !((c * i) <= 1.45e+22)) {
tmp = (a * b) + (c * i);
} else {
tmp = (x * y) + (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) <= (-6d+118)) .or. (.not. ((c * i) <= 1.45d+22))) then
tmp = (a * b) + (c * i)
else
tmp = (x * y) + (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) <= -6e+118) || !((c * i) <= 1.45e+22)) {
tmp = (a * b) + (c * i);
} else {
tmp = (x * y) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -6e+118) or not ((c * i) <= 1.45e+22): tmp = (a * b) + (c * i) else: tmp = (x * y) + (a * b) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -6e+118) || !(Float64(c * i) <= 1.45e+22)) tmp = Float64(Float64(a * b) + Float64(c * i)); else tmp = Float64(Float64(x * y) + 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) <= -6e+118) || ~(((c * i) <= 1.45e+22))) tmp = (a * b) + (c * i); else tmp = (x * y) + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -6e+118], N[Not[LessEqual[N[(c * i), $MachinePrecision], 1.45e+22]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -6 \cdot 10^{+118} \lor \neg \left(c \cdot i \leq 1.45 \cdot 10^{+22}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -6e118 or 1.45e22 < (*.f64 c i) Initial program 92.9%
+-commutative92.9%
fma-define94.7%
+-commutative94.7%
fma-define95.6%
fma-define96.4%
Simplified96.4%
Taylor expanded in x around 0 85.9%
Taylor expanded in c around inf 76.5%
if -6e118 < (*.f64 c i) < 1.45e22Initial program 96.5%
+-commutative96.5%
fma-define96.5%
+-commutative96.5%
fma-define99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in c around 0 93.6%
Taylor expanded in t around 0 67.9%
Final simplification71.7%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -6.8e+230) (not (<= (* x y) 3e+199))) (* 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) <= -6.8e+230) || !((x * y) <= 3e+199)) {
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) <= (-6.8d+230)) .or. (.not. ((x * y) <= 3d+199))) 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) <= -6.8e+230) || !((x * y) <= 3e+199)) {
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) <= -6.8e+230) or not ((x * y) <= 3e+199): 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) <= -6.8e+230) || !(Float64(x * y) <= 3e+199)) 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) <= -6.8e+230) || ~(((x * y) <= 3e+199))) 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], -6.8e+230], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3e+199]], $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 -6.8 \cdot 10^{+230} \lor \neg \left(x \cdot y \leq 3 \cdot 10^{+199}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -6.79999999999999973e230 or 3.0000000000000001e199 < (*.f64 x y) Initial program 85.2%
+-commutative85.2%
fma-define86.9%
+-commutative86.9%
fma-define95.1%
fma-define96.7%
Simplified96.7%
Taylor expanded in c around 0 83.8%
Taylor expanded in t around 0 80.7%
Taylor expanded in a around 0 80.8%
if -6.79999999999999973e230 < (*.f64 x y) < 3.0000000000000001e199Initial program 97.9%
+-commutative97.9%
fma-define98.4%
+-commutative98.4%
fma-define98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in x around 0 86.9%
Taylor expanded in c around inf 64.2%
Final simplification68.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -3.5e+196) (not (<= (* a b) 2.16e+130))) (* a b) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -3.5e+196) || !((a * b) <= 2.16e+130)) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((a * b) <= (-3.5d+196)) .or. (.not. ((a * b) <= 2.16d+130))) then
tmp = a * b
else
tmp = c * i
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -3.5e+196) || !((a * b) <= 2.16e+130)) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -3.5e+196) or not ((a * b) <= 2.16e+130): tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -3.5e+196) || !(Float64(a * b) <= 2.16e+130)) tmp = Float64(a * b); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((a * b) <= -3.5e+196) || ~(((a * b) <= 2.16e+130))) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -3.5e+196], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.16e+130]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3.5 \cdot 10^{+196} \lor \neg \left(a \cdot b \leq 2.16 \cdot 10^{+130}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 a b) < -3.4999999999999998e196 or 2.1600000000000001e130 < (*.f64 a b) Initial program 87.7%
+-commutative87.7%
fma-define89.2%
+-commutative89.2%
fma-define96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in a around inf 78.9%
if -3.4999999999999998e196 < (*.f64 a b) < 2.1600000000000001e130Initial program 97.4%
+-commutative97.4%
fma-define97.9%
+-commutative97.9%
fma-define97.9%
fma-define98.4%
Simplified98.4%
Taylor expanded in c around inf 40.7%
Final simplification50.4%
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
def code(x, y, z, t, a, b, c, i): return a * b
function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 94.9%
+-commutative94.9%
fma-define95.7%
+-commutative95.7%
fma-define97.6%
fma-define98.0%
Simplified98.0%
Taylor expanded in a around inf 24.6%
herbie shell --seed 2024160
(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)))