
(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 93.7%
+-commutative93.7%
fma-define96.1%
+-commutative96.1%
fma-define97.7%
fma-define98.8%
Simplified98.8%
(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 (* z (+ t (+ (* x (/ y z)) (* a (/ b 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) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = z * (t + ((x * (y / z)) + (a * (b / 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) + ((z * t) + (x * y)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = z * (t + ((x * (y / z)) + (a * (b / z))));
}
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 = z * (t + ((x * (y / z)) + (a * (b / 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(z * t) + Float64(x * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(z * Float64(t + Float64(Float64(x * Float64(y / z)) + Float64(a * Float64(b / z))))); 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 = z * (t + ((x * (y / z)) + (a * (b / 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[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(t + N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}:\\
\;\;\;\;z \cdot \left(t + \left(x \cdot \frac{y}{z} + a \cdot \frac{b}{z}\right)\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-define37.5%
+-commutative37.5%
fma-define62.5%
fma-define81.3%
Simplified81.3%
Taylor expanded in c around 0 37.5%
Taylor expanded in z around inf 37.5%
+-commutative37.5%
associate-/l*56.3%
associate-/l*75.0%
Simplified75.0%
Final simplification98.4%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* z t) -8e+132)
(* z t)
(if (<= (* z t) -1e-133)
(* c i)
(if (<= (* z t) 1.5e-119)
(* x y)
(if (<= (* z t) 7e+67) (* 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 ((z * t) <= -8e+132) {
tmp = z * t;
} else if ((z * t) <= -1e-133) {
tmp = c * i;
} else if ((z * t) <= 1.5e-119) {
tmp = x * y;
} else if ((z * t) <= 7e+67) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((z * t) <= (-8d+132)) then
tmp = z * t
else if ((z * t) <= (-1d-133)) then
tmp = c * i
else if ((z * t) <= 1.5d-119) then
tmp = x * y
else if ((z * t) <= 7d+67) then
tmp = a * b
else
tmp = z * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -8e+132) {
tmp = z * t;
} else if ((z * t) <= -1e-133) {
tmp = c * i;
} else if ((z * t) <= 1.5e-119) {
tmp = x * y;
} else if ((z * t) <= 7e+67) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -8e+132: tmp = z * t elif (z * t) <= -1e-133: tmp = c * i elif (z * t) <= 1.5e-119: tmp = x * y elif (z * t) <= 7e+67: tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -8e+132) tmp = Float64(z * t); elseif (Float64(z * t) <= -1e-133) tmp = Float64(c * i); elseif (Float64(z * t) <= 1.5e-119) tmp = Float64(x * y); elseif (Float64(z * t) <= 7e+67) tmp = Float64(a * b); else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z * t) <= -8e+132) tmp = z * t; elseif ((z * t) <= -1e-133) tmp = c * i; elseif ((z * t) <= 1.5e-119) tmp = x * y; elseif ((z * t) <= 7e+67) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -8e+132], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-133], N[(c * i), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1.5e-119], N[(x * y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 7e+67], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -8 \cdot 10^{+132}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-133}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;z \cdot t \leq 1.5 \cdot 10^{-119}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \cdot t \leq 7 \cdot 10^{+67}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -7.99999999999999993e132 or 7e67 < (*.f64 z t) Initial program 90.4%
+-commutative90.4%
fma-define92.3%
+-commutative92.3%
fma-define95.2%
fma-define98.1%
Simplified98.1%
Taylor expanded in x around 0 89.5%
Taylor expanded in c around 0 81.0%
Taylor expanded in a around 0 72.3%
*-commutative72.3%
Simplified72.3%
if -7.99999999999999993e132 < (*.f64 z t) < -1.0000000000000001e-133Initial program 94.9%
+-commutative94.9%
fma-define98.3%
+-commutative98.3%
fma-define98.3%
fma-define98.3%
Simplified98.3%
Taylor expanded in c around inf 38.6%
if -1.0000000000000001e-133 < (*.f64 z t) < 1.5000000000000001e-119Initial program 95.8%
+-commutative95.8%
fma-define98.6%
+-commutative98.6%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 73.9%
Taylor expanded in t around 0 73.9%
Taylor expanded in a around 0 49.1%
if 1.5000000000000001e-119 < (*.f64 z t) < 7e67Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in a around inf 45.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -1.18e+114) (not (<= (* c i) 2.3e+67))) (+ (* a b) (+ (* z t) (* c i))) (+ (* a b) (+ (* z t) (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -1.18e+114) || !((c * i) <= 2.3e+67)) {
tmp = (a * b) + ((z * t) + (c * i));
} else {
tmp = (a * b) + ((z * t) + (x * y));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((c * i) <= (-1.18d+114)) .or. (.not. ((c * i) <= 2.3d+67))) then
tmp = (a * b) + ((z * t) + (c * i))
else
tmp = (a * b) + ((z * t) + (x * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -1.18e+114) || !((c * i) <= 2.3e+67)) {
tmp = (a * b) + ((z * t) + (c * i));
} else {
tmp = (a * b) + ((z * t) + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -1.18e+114) or not ((c * i) <= 2.3e+67): tmp = (a * b) + ((z * t) + (c * i)) else: tmp = (a * b) + ((z * t) + (x * y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -1.18e+114) || !(Float64(c * i) <= 2.3e+67)) tmp = Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(c * i))); else tmp = Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -1.18e+114) || ~(((c * i) <= 2.3e+67))) tmp = (a * b) + ((z * t) + (c * i)); else tmp = (a * b) + ((z * t) + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -1.18e+114], N[Not[LessEqual[N[(c * i), $MachinePrecision], 2.3e+67]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.18 \cdot 10^{+114} \lor \neg \left(c \cdot i \leq 2.3 \cdot 10^{+67}\right):\\
\;\;\;\;a \cdot b + \left(z \cdot t + c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(z \cdot t + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -1.18000000000000005e114 or 2.2999999999999999e67 < (*.f64 c i) Initial program 87.4%
+-commutative87.4%
fma-define93.7%
+-commutative93.7%
fma-define94.7%
fma-define96.8%
Simplified96.8%
Taylor expanded in x around 0 86.2%
if -1.18000000000000005e114 < (*.f64 c i) < 2.2999999999999999e67Initial program 97.5%
+-commutative97.5%
fma-define97.5%
+-commutative97.5%
fma-define99.4%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 92.9%
Final simplification90.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -2.9e+114) (not (<= (* x y) 4.5e+156))) (+ (* z t) (* x y)) (+ (* a b) (+ (* 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 (((x * y) <= -2.9e+114) || !((x * y) <= 4.5e+156)) {
tmp = (z * t) + (x * y);
} else {
tmp = (a * b) + ((z * t) + (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.9d+114)) .or. (.not. ((x * y) <= 4.5d+156))) then
tmp = (z * t) + (x * y)
else
tmp = (a * b) + ((z * t) + (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.9e+114) || !((x * y) <= 4.5e+156)) {
tmp = (z * t) + (x * y);
} else {
tmp = (a * b) + ((z * t) + (c * i));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -2.9e+114) or not ((x * y) <= 4.5e+156): tmp = (z * t) + (x * y) else: tmp = (a * b) + ((z * t) + (c * i)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -2.9e+114) || !(Float64(x * y) <= 4.5e+156)) tmp = Float64(Float64(z * t) + Float64(x * y)); else tmp = Float64(Float64(a * b) + Float64(Float64(z * t) + 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.9e+114) || ~(((x * y) <= 4.5e+156))) tmp = (z * t) + (x * y); else tmp = (a * b) + ((z * t) + (c * i)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2.9e+114], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4.5e+156]], $MachinePrecision]], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.9 \cdot 10^{+114} \lor \neg \left(x \cdot y \leq 4.5 \cdot 10^{+156}\right):\\
\;\;\;\;z \cdot t + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(z \cdot t + c \cdot i\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.9e114 or 4.50000000000000031e156 < (*.f64 x y) Initial program 90.9%
+-commutative90.9%
fma-define93.9%
+-commutative93.9%
fma-define95.5%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 88.2%
Taylor expanded in a around 0 81.0%
if -2.9e114 < (*.f64 x y) < 4.50000000000000031e156Initial program 94.7%
+-commutative94.7%
fma-define96.8%
+-commutative96.8%
fma-define98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in x around 0 88.6%
Final simplification86.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -1.4e+115) (* c i) (if (<= (* c i) -1.75e-7) (* a b) (if (<= (* c i) 5e+70) (* x y) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1.4e+115) {
tmp = c * i;
} else if ((c * i) <= -1.75e-7) {
tmp = a * b;
} else if ((c * i) <= 5e+70) {
tmp = x * y;
} else {
tmp = c * i;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((c * i) <= (-1.4d+115)) then
tmp = c * i
else if ((c * i) <= (-1.75d-7)) then
tmp = a * b
else if ((c * i) <= 5d+70) then
tmp = x * y
else
tmp = c * i
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1.4e+115) {
tmp = c * i;
} else if ((c * i) <= -1.75e-7) {
tmp = a * b;
} else if ((c * i) <= 5e+70) {
tmp = x * y;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -1.4e+115: tmp = c * i elif (c * i) <= -1.75e-7: tmp = a * b elif (c * i) <= 5e+70: tmp = x * y else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1.4e+115) tmp = Float64(c * i); elseif (Float64(c * i) <= -1.75e-7) tmp = Float64(a * b); elseif (Float64(c * i) <= 5e+70) tmp = Float64(x * y); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -1.4e+115) tmp = c * i; elseif ((c * i) <= -1.75e-7) tmp = a * b; elseif ((c * i) <= 5e+70) tmp = x * y; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1.4e+115], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -1.75e-7], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5e+70], N[(x * y), $MachinePrecision], N[(c * i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.4 \cdot 10^{+115}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -1.75 \cdot 10^{-7}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+70}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -1.4e115 or 5.0000000000000002e70 < (*.f64 c i) Initial program 87.4%
+-commutative87.4%
fma-define93.7%
+-commutative93.7%
fma-define94.7%
fma-define96.8%
Simplified96.8%
Taylor expanded in c around inf 61.8%
if -1.4e115 < (*.f64 c i) < -1.74999999999999992e-7Initial program 96.3%
+-commutative96.3%
fma-define96.3%
+-commutative96.3%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in a around inf 35.3%
if -1.74999999999999992e-7 < (*.f64 c i) < 5.0000000000000002e70Initial program 97.7%
+-commutative97.7%
fma-define97.7%
+-commutative97.7%
fma-define99.3%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 93.0%
Taylor expanded in t around 0 60.7%
Taylor expanded in a around 0 34.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+40) (+ (* z t) (* c i)) (if (<= (* z t) 1e+52) (+ (* x y) (* a b)) (* z (+ t (* a (/ b z)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+40) {
tmp = (z * t) + (c * i);
} else if ((z * t) <= 1e+52) {
tmp = (x * y) + (a * b);
} else {
tmp = z * (t + (a * (b / z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((z * t) <= (-5d+40)) then
tmp = (z * t) + (c * i)
else if ((z * t) <= 1d+52) then
tmp = (x * y) + (a * b)
else
tmp = z * (t + (a * (b / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+40) {
tmp = (z * t) + (c * i);
} else if ((z * t) <= 1e+52) {
tmp = (x * y) + (a * b);
} else {
tmp = z * (t + (a * (b / z)));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -5e+40: tmp = (z * t) + (c * i) elif (z * t) <= 1e+52: tmp = (x * y) + (a * b) else: tmp = z * (t + (a * (b / z))) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+40) tmp = Float64(Float64(z * t) + Float64(c * i)); elseif (Float64(z * t) <= 1e+52) tmp = Float64(Float64(x * y) + Float64(a * b)); else tmp = Float64(z * Float64(t + Float64(a * Float64(b / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z * t) <= -5e+40) tmp = (z * t) + (c * i); elseif ((z * t) <= 1e+52) tmp = (x * y) + (a * b); else tmp = z * (t + (a * (b / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+40], N[(N[(z * t), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+52], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(z * N[(t + N[(a * N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+40}:\\
\;\;\;\;z \cdot t + c \cdot i\\
\mathbf{elif}\;z \cdot t \leq 10^{+52}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t + a \cdot \frac{b}{z}\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000003e40Initial program 93.0%
+-commutative93.0%
fma-define94.4%
+-commutative94.4%
fma-define94.4%
fma-define97.2%
Simplified97.2%
Taylor expanded in x around 0 87.8%
Taylor expanded in a around 0 74.9%
if -5.00000000000000003e40 < (*.f64 z t) < 9.9999999999999999e51Initial program 95.3%
+-commutative95.3%
fma-define98.4%
+-commutative98.4%
fma-define99.2%
fma-define99.2%
Simplified99.2%
Taylor expanded in c around 0 71.3%
Taylor expanded in t around 0 67.8%
if 9.9999999999999999e51 < (*.f64 z t) Initial program 91.2%
+-commutative91.2%
fma-define93.0%
+-commutative93.0%
fma-define98.2%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 87.9%
Taylor expanded in c around 0 77.9%
Taylor expanded in z around inf 77.9%
+-commutative77.9%
associate-/l*83.3%
Simplified83.3%
Final simplification73.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -5e+40) (not (<= (* z t) 5e+52))) (+ (* z t) (* 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 (((z * t) <= -5e+40) || !((z * t) <= 5e+52)) {
tmp = (z * t) + (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 (((z * t) <= (-5d+40)) .or. (.not. ((z * t) <= 5d+52))) then
tmp = (z * t) + (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 (((z * t) <= -5e+40) || !((z * t) <= 5e+52)) {
tmp = (z * t) + (c * i);
} else {
tmp = (x * y) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((z * t) <= -5e+40) or not ((z * t) <= 5e+52): tmp = (z * t) + (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(z * t) <= -5e+40) || !(Float64(z * t) <= 5e+52)) tmp = Float64(Float64(z * t) + 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 (((z * t) <= -5e+40) || ~(((z * t) <= 5e+52))) tmp = (z * t) + (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[(z * t), $MachinePrecision], -5e+40], N[Not[LessEqual[N[(z * t), $MachinePrecision], 5e+52]], $MachinePrecision]], N[(N[(z * t), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+40} \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+52}\right):\\
\;\;\;\;z \cdot t + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000003e40 or 5e52 < (*.f64 z t) Initial program 92.2%
+-commutative92.2%
fma-define93.7%
+-commutative93.7%
fma-define96.1%
fma-define98.4%
Simplified98.4%
Taylor expanded in x around 0 87.7%
Taylor expanded in a around 0 77.0%
if -5.00000000000000003e40 < (*.f64 z t) < 5e52Initial program 95.3%
+-commutative95.3%
fma-define98.4%
+-commutative98.4%
fma-define99.2%
fma-define99.2%
Simplified99.2%
Taylor expanded in c around 0 71.5%
Taylor expanded in t around 0 68.1%
Final simplification72.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -1e+115) (not (<= (* z t) 1e+52))) (+ (* z t) (* a b)) (+ (* 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 (((z * t) <= -1e+115) || !((z * t) <= 1e+52)) {
tmp = (z * t) + (a * b);
} 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 (((z * t) <= (-1d+115)) .or. (.not. ((z * t) <= 1d+52))) then
tmp = (z * t) + (a * b)
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 (((z * t) <= -1e+115) || !((z * t) <= 1e+52)) {
tmp = (z * t) + (a * b);
} else {
tmp = (x * y) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((z * t) <= -1e+115) or not ((z * t) <= 1e+52): tmp = (z * t) + (a * b) else: tmp = (x * y) + (a * b) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(z * t) <= -1e+115) || !(Float64(z * t) <= 1e+52)) tmp = Float64(Float64(z * t) + Float64(a * b)); 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 (((z * t) <= -1e+115) || ~(((z * t) <= 1e+52))) tmp = (z * t) + (a * b); else tmp = (x * y) + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -1e+115], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+52]], $MachinePrecision]], N[(N[(z * t), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+115} \lor \neg \left(z \cdot t \leq 10^{+52}\right):\\
\;\;\;\;z \cdot t + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\end{array}
\end{array}
if (*.f64 z t) < -1e115 or 9.9999999999999999e51 < (*.f64 z t) Initial program 91.1%
+-commutative91.1%
fma-define92.8%
+-commutative92.8%
fma-define95.5%
fma-define98.2%
Simplified98.2%
Taylor expanded in x around 0 90.3%
Taylor expanded in c around 0 78.7%
if -1e115 < (*.f64 z t) < 9.9999999999999999e51Initial program 95.8%
+-commutative95.8%
fma-define98.6%
+-commutative98.6%
fma-define99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in c around 0 70.5%
Taylor expanded in t around 0 65.5%
Final simplification71.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -1.35e+248) (not (<= (* c i) 4.8e+228))) (* c i) (+ (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -1.35e+248) || !((c * i) <= 4.8e+228)) {
tmp = c * i;
} else {
tmp = (z * t) + (a * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((c * i) <= (-1.35d+248)) .or. (.not. ((c * i) <= 4.8d+228))) then
tmp = c * i
else
tmp = (z * t) + (a * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -1.35e+248) || !((c * i) <= 4.8e+228)) {
tmp = c * i;
} else {
tmp = (z * t) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -1.35e+248) or not ((c * i) <= 4.8e+228): tmp = c * i else: tmp = (z * t) + (a * b) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -1.35e+248) || !(Float64(c * i) <= 4.8e+228)) tmp = Float64(c * i); else tmp = Float64(Float64(z * t) + Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -1.35e+248) || ~(((c * i) <= 4.8e+228))) tmp = c * i; else tmp = (z * t) + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -1.35e+248], N[Not[LessEqual[N[(c * i), $MachinePrecision], 4.8e+228]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.35 \cdot 10^{+248} \lor \neg \left(c \cdot i \leq 4.8 \cdot 10^{+228}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -1.34999999999999994e248 or 4.79999999999999977e228 < (*.f64 c i) Initial program 79.2%
+-commutative79.2%
fma-define90.6%
+-commutative90.6%
fma-define92.5%
fma-define94.3%
Simplified94.3%
Taylor expanded in c around inf 81.3%
if -1.34999999999999994e248 < (*.f64 c i) < 4.79999999999999977e228Initial program 97.5%
+-commutative97.5%
fma-define97.5%
+-commutative97.5%
fma-define99.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 75.0%
Taylor expanded in c around 0 64.1%
Final simplification67.7%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -2.5e+115) (not (<= (* c i) 1.3e+62))) (* 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) <= -2.5e+115) || !((c * i) <= 1.3e+62)) {
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) <= (-2.5d+115)) .or. (.not. ((c * i) <= 1.3d+62))) 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) <= -2.5e+115) || !((c * i) <= 1.3e+62)) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -2.5e+115) or not ((c * i) <= 1.3e+62): 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) <= -2.5e+115) || !(Float64(c * i) <= 1.3e+62)) 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) <= -2.5e+115) || ~(((c * i) <= 1.3e+62))) 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], -2.5e+115], N[Not[LessEqual[N[(c * i), $MachinePrecision], 1.3e+62]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.5 \cdot 10^{+115} \lor \neg \left(c \cdot i \leq 1.3 \cdot 10^{+62}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -2.50000000000000004e115 or 1.29999999999999992e62 < (*.f64 c i) Initial program 87.5%
+-commutative87.5%
fma-define93.8%
+-commutative93.8%
fma-define94.8%
fma-define96.9%
Simplified96.9%
Taylor expanded in c around inf 61.2%
if -2.50000000000000004e115 < (*.f64 c i) < 1.29999999999999992e62Initial program 97.5%
+-commutative97.5%
fma-define97.5%
+-commutative97.5%
fma-define99.4%
fma-define100.0%
Simplified100.0%
Taylor expanded in a around inf 31.6%
Final simplification42.7%
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
def code(x, y, z, t, a, b, c, i): return a * b
function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 93.7%
+-commutative93.7%
fma-define96.1%
+-commutative96.1%
fma-define97.7%
fma-define98.8%
Simplified98.8%
Taylor expanded in a around inf 25.1%
herbie shell --seed 2024123
(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)))