
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (fma c i (fma x y (fma z t (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, fma(x, y, fma(z, t, (a * b))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)
\end{array}
Initial program 94.5%
+-commutative94.5%
fma-define96.5%
associate-+l+96.5%
fma-define97.3%
fma-define98.8%
Simplified98.8%
Final simplification98.8%
(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.5%
+-commutative94.5%
fma-define96.5%
+-commutative96.5%
fma-define97.3%
fma-define97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (+ (+ (* a b) (+ (* x y) (* z t))) (* c i)) INFINITY) (+ (fma z t (* a b)) (+ (* x y) (* c i))) (fma t z (* 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) + ((x * y) + (z * t))) + (c * i)) <= ((double) INFINITY)) {
tmp = fma(z, t, (a * b)) + ((x * y) + (c * i));
} else {
tmp = fma(t, z, (a * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) + Float64(c * i)) <= Inf) tmp = Float64(fma(z, t, Float64(a * b)) + Float64(Float64(x * y) + Float64(c * i))); else tmp = fma(t, z, Float64(a * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * z + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) + c \cdot i \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(z, t, a \cdot b\right) + \left(x \cdot y + c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, z, a \cdot b\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
fma-define100.0%
Simplified100.0%
fma-undefine100.0%
fma-undefine100.0%
+-commutative100.0%
fma-define100.0%
associate-+l+100.0%
fma-undefine100.0%
associate-+r+100.0%
Applied egg-rr100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
Taylor expanded in x around 0 14.3%
Taylor expanded in c around 0 50.0%
+-commutative50.0%
fma-undefine78.6%
Simplified78.6%
Final simplification98.8%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (+ (* a b) (+ (* x y) (* z t))) (* c i)))) (if (<= t_1 INFINITY) t_1 (fma t z (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(t, z, (a * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) + Float64(c * i)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(t, z, Float64(a * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(t * z + N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) + c \cdot i\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, z, a \cdot b\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
Taylor expanded in x around 0 14.3%
Taylor expanded in c around 0 50.0%
+-commutative50.0%
fma-undefine78.6%
Simplified78.6%
Final simplification98.8%
(FPCore (x y z t a b c i)
:precision binary64
(if (or (<= z -1.08e+253)
(not
(or (<= z -3.1e+249)
(and (not (<= z -1.02e+152))
(or (<= z -3.7e+73)
(and (not (<= z -2.15e+52)) (<= z 2e+66)))))))
(* 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 ((z <= -1.08e+253) || !((z <= -3.1e+249) || (!(z <= -1.02e+152) && ((z <= -3.7e+73) || (!(z <= -2.15e+52) && (z <= 2e+66)))))) {
tmp = 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 ((z <= (-1.08d+253)) .or. (.not. (z <= (-3.1d+249)) .or. (.not. (z <= (-1.02d+152))) .and. (z <= (-3.7d+73)) .or. (.not. (z <= (-2.15d+52))) .and. (z <= 2d+66))) then
tmp = 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 ((z <= -1.08e+253) || !((z <= -3.1e+249) || (!(z <= -1.02e+152) && ((z <= -3.7e+73) || (!(z <= -2.15e+52) && (z <= 2e+66)))))) {
tmp = z * t;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z <= -1.08e+253) or not ((z <= -3.1e+249) or (not (z <= -1.02e+152) and ((z <= -3.7e+73) or (not (z <= -2.15e+52) and (z <= 2e+66))))): tmp = z * t else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((z <= -1.08e+253) || !((z <= -3.1e+249) || (!(z <= -1.02e+152) && ((z <= -3.7e+73) || (!(z <= -2.15e+52) && (z <= 2e+66)))))) tmp = 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 ((z <= -1.08e+253) || ~(((z <= -3.1e+249) || (~((z <= -1.02e+152)) && ((z <= -3.7e+73) || (~((z <= -2.15e+52)) && (z <= 2e+66))))))) tmp = z * t; else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[z, -1.08e+253], N[Not[Or[LessEqual[z, -3.1e+249], And[N[Not[LessEqual[z, -1.02e+152]], $MachinePrecision], Or[LessEqual[z, -3.7e+73], And[N[Not[LessEqual[z, -2.15e+52]], $MachinePrecision], LessEqual[z, 2e+66]]]]]], $MachinePrecision]], N[(z * t), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.08 \cdot 10^{+253} \lor \neg \left(z \leq -3.1 \cdot 10^{+249} \lor \neg \left(z \leq -1.02 \cdot 10^{+152}\right) \land \left(z \leq -3.7 \cdot 10^{+73} \lor \neg \left(z \leq -2.15 \cdot 10^{+52}\right) \land z \leq 2 \cdot 10^{+66}\right)\right):\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if z < -1.08000000000000004e253 or -3.10000000000000015e249 < z < -1.01999999999999999e152 or -3.69999999999999973e73 < z < -2.15e52 or 1.99999999999999989e66 < z Initial program 91.7%
Taylor expanded in z around inf 56.1%
if -1.08000000000000004e253 < z < -3.10000000000000015e249 or -1.01999999999999999e152 < z < -3.69999999999999973e73 or -2.15e52 < z < 1.99999999999999989e66Initial program 96.2%
Taylor expanded in x around 0 75.2%
Taylor expanded in a around inf 61.9%
Final simplification59.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))) (t_2 (+ (* x y) (* c i))))
(if (<= (* x y) -3.9e+123)
t_2
(if (<= (* x y) -2.1e-46)
t_1
(if (<= (* x y) -4e-313)
(+ (* a b) (* c i))
(if (<= (* x y) 125000000.0) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (a * b) + (z * t);
double t_2 = (x * y) + (c * i);
double tmp;
if ((x * y) <= -3.9e+123) {
tmp = t_2;
} else if ((x * y) <= -2.1e-46) {
tmp = t_1;
} else if ((x * y) <= -4e-313) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 125000000.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (a * b) + (z * t)
t_2 = (x * y) + (c * i)
if ((x * y) <= (-3.9d+123)) then
tmp = t_2
else if ((x * y) <= (-2.1d-46)) then
tmp = t_1
else if ((x * y) <= (-4d-313)) then
tmp = (a * b) + (c * i)
else if ((x * y) <= 125000000.0d0) then
tmp = t_1
else
tmp = t_2
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) + (z * t);
double t_2 = (x * y) + (c * i);
double tmp;
if ((x * y) <= -3.9e+123) {
tmp = t_2;
} else if ((x * y) <= -2.1e-46) {
tmp = t_1;
} else if ((x * y) <= -4e-313) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 125000000.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (a * b) + (z * t) t_2 = (x * y) + (c * i) tmp = 0 if (x * y) <= -3.9e+123: tmp = t_2 elif (x * y) <= -2.1e-46: tmp = t_1 elif (x * y) <= -4e-313: tmp = (a * b) + (c * i) elif (x * y) <= 125000000.0: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(a * b) + Float64(z * t)) t_2 = Float64(Float64(x * y) + Float64(c * i)) tmp = 0.0 if (Float64(x * y) <= -3.9e+123) tmp = t_2; elseif (Float64(x * y) <= -2.1e-46) tmp = t_1; elseif (Float64(x * y) <= -4e-313) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(x * y) <= 125000000.0) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (a * b) + (z * t); t_2 = (x * y) + (c * i); tmp = 0.0; if ((x * y) <= -3.9e+123) tmp = t_2; elseif ((x * y) <= -2.1e-46) tmp = t_1; elseif ((x * y) <= -4e-313) tmp = (a * b) + (c * i); elseif ((x * y) <= 125000000.0) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -3.9e+123], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -2.1e-46], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -4e-313], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 125000000.0], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := x \cdot y + c \cdot i\\
\mathbf{if}\;x \cdot y \leq -3.9 \cdot 10^{+123}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq -2.1 \cdot 10^{-46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-313}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 125000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 x y) < -3.89999999999999993e123 or 1.25e8 < (*.f64 x y) Initial program 91.6%
Taylor expanded in a around 0 88.7%
Taylor expanded in t around 0 75.6%
if -3.89999999999999993e123 < (*.f64 x y) < -2.09999999999999987e-46 or -4.0000000000037e-313 < (*.f64 x y) < 1.25e8Initial program 95.9%
Taylor expanded in x around 0 93.5%
Taylor expanded in c around 0 75.4%
if -2.09999999999999987e-46 < (*.f64 x y) < -4.0000000000037e-313Initial program 97.5%
Taylor expanded in x around 0 95.2%
Taylor expanded in a around inf 78.2%
Final simplification75.9%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (+ (* a b) (+ (* x y) (* z t))) (* c i)))) (if (<= t_1 INFINITY) t_1 (* a b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = a * b;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) + Float64(c * i)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) + c \cdot i\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
Taylor expanded in a around inf 50.9%
Final simplification97.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -3.5e+142) (not (<= (* x y) 780000000.0))) (+ (* x y) (* c i)) (+ (* 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) <= -3.5e+142) || !((x * y) <= 780000000.0)) {
tmp = (x * y) + (c * i);
} else {
tmp = (c * i) + ((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) <= (-3.5d+142)) .or. (.not. ((x * y) <= 780000000.0d0))) then
tmp = (x * y) + (c * i)
else
tmp = (c * i) + ((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) <= -3.5e+142) || !((x * y) <= 780000000.0)) {
tmp = (x * y) + (c * i);
} else {
tmp = (c * i) + ((a * b) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -3.5e+142) or not ((x * y) <= 780000000.0): tmp = (x * y) + (c * i) else: tmp = (c * i) + ((a * b) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -3.5e+142) || !(Float64(x * y) <= 780000000.0)) tmp = Float64(Float64(x * y) + Float64(c * i)); else tmp = Float64(Float64(c * i) + 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) <= -3.5e+142) || ~(((x * y) <= 780000000.0))) tmp = (x * y) + (c * i); else tmp = (c * i) + ((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], -3.5e+142], N[Not[LessEqual[N[(x * y), $MachinePrecision], 780000000.0]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.5 \cdot 10^{+142} \lor \neg \left(x \cdot y \leq 780000000\right):\\
\;\;\;\;x \cdot y + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -3.49999999999999997e142 or 7.8e8 < (*.f64 x y) Initial program 91.4%
Taylor expanded in a around 0 88.5%
Taylor expanded in t around 0 75.1%
if -3.49999999999999997e142 < (*.f64 x y) < 7.8e8Initial program 96.3%
Taylor expanded in x around 0 94.0%
Final simplification87.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -7e+134) (not (<= (* x y) 0.0045))) (+ (* c i) (+ (* x y) (* z t))) (+ (* 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) <= -7e+134) || !((x * y) <= 0.0045)) {
tmp = (c * i) + ((x * y) + (z * t));
} else {
tmp = (c * i) + ((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) <= (-7d+134)) .or. (.not. ((x * y) <= 0.0045d0))) then
tmp = (c * i) + ((x * y) + (z * t))
else
tmp = (c * i) + ((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) <= -7e+134) || !((x * y) <= 0.0045)) {
tmp = (c * i) + ((x * y) + (z * t));
} else {
tmp = (c * i) + ((a * b) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -7e+134) or not ((x * y) <= 0.0045): tmp = (c * i) + ((x * y) + (z * t)) else: tmp = (c * i) + ((a * b) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -7e+134) || !(Float64(x * y) <= 0.0045)) tmp = Float64(Float64(c * i) + Float64(Float64(x * y) + Float64(z * t))); else tmp = Float64(Float64(c * i) + 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) <= -7e+134) || ~(((x * y) <= 0.0045))) tmp = (c * i) + ((x * y) + (z * t)); else tmp = (c * i) + ((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], -7e+134], N[Not[LessEqual[N[(x * y), $MachinePrecision], 0.0045]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -7 \cdot 10^{+134} \lor \neg \left(x \cdot y \leq 0.0045\right):\\
\;\;\;\;c \cdot i + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -7.00000000000000006e134 or 0.00449999999999999966 < (*.f64 x y) Initial program 91.7%
Taylor expanded in a around 0 88.8%
if -7.00000000000000006e134 < (*.f64 x y) < 0.00449999999999999966Initial program 96.2%
Taylor expanded in x around 0 93.9%
Final simplification92.0%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= c -1.7e+151)
(* c i)
(if (<= c -4.6e+108)
(* z t)
(if (<= c -1.16e-82) (* a b) (if (<= c 1.22e-113) (* 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 <= -1.7e+151) {
tmp = c * i;
} else if (c <= -4.6e+108) {
tmp = z * t;
} else if (c <= -1.16e-82) {
tmp = a * b;
} else if (c <= 1.22e-113) {
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 <= (-1.7d+151)) then
tmp = c * i
else if (c <= (-4.6d+108)) then
tmp = z * t
else if (c <= (-1.16d-82)) then
tmp = a * b
else if (c <= 1.22d-113) 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 <= -1.7e+151) {
tmp = c * i;
} else if (c <= -4.6e+108) {
tmp = z * t;
} else if (c <= -1.16e-82) {
tmp = a * b;
} else if (c <= 1.22e-113) {
tmp = z * t;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if c <= -1.7e+151: tmp = c * i elif c <= -4.6e+108: tmp = z * t elif c <= -1.16e-82: tmp = a * b elif c <= 1.22e-113: tmp = z * t else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (c <= -1.7e+151) tmp = Float64(c * i); elseif (c <= -4.6e+108) tmp = Float64(z * t); elseif (c <= -1.16e-82) tmp = Float64(a * b); elseif (c <= 1.22e-113) 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 <= -1.7e+151) tmp = c * i; elseif (c <= -4.6e+108) tmp = z * t; elseif (c <= -1.16e-82) tmp = a * b; elseif (c <= 1.22e-113) tmp = z * t; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[c, -1.7e+151], N[(c * i), $MachinePrecision], If[LessEqual[c, -4.6e+108], N[(z * t), $MachinePrecision], If[LessEqual[c, -1.16e-82], N[(a * b), $MachinePrecision], If[LessEqual[c, 1.22e-113], N[(z * t), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.7 \cdot 10^{+151}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \leq -4.6 \cdot 10^{+108}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \leq -1.16 \cdot 10^{-82}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \leq 1.22 \cdot 10^{-113}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if c < -1.7e151 or 1.21999999999999995e-113 < c Initial program 92.3%
Taylor expanded in c around inf 43.9%
if -1.7e151 < c < -4.5999999999999998e108 or -1.16e-82 < c < 1.21999999999999995e-113Initial program 96.4%
Taylor expanded in z around inf 47.8%
if -4.5999999999999998e108 < c < -1.16e-82Initial program 97.6%
Taylor expanded in a around inf 39.3%
Final simplification44.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -1.1e+135) (not (<= (* a b) 3.8e+36))) (* 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) <= -1.1e+135) || !((a * b) <= 3.8e+36)) {
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) <= (-1.1d+135)) .or. (.not. ((a * b) <= 3.8d+36))) 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) <= -1.1e+135) || !((a * b) <= 3.8e+36)) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -1.1e+135) or not ((a * b) <= 3.8e+36): 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) <= -1.1e+135) || !(Float64(a * b) <= 3.8e+36)) 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) <= -1.1e+135) || ~(((a * b) <= 3.8e+36))) 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], -1.1e+135], N[Not[LessEqual[N[(a * b), $MachinePrecision], 3.8e+36]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.1 \cdot 10^{+135} \lor \neg \left(a \cdot b \leq 3.8 \cdot 10^{+36}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 a b) < -1.1e135 or 3.80000000000000025e36 < (*.f64 a b) Initial program 88.7%
Taylor expanded in a around inf 56.1%
if -1.1e135 < (*.f64 a b) < 3.80000000000000025e36Initial program 97.6%
Taylor expanded in c around inf 36.0%
Final simplification42.9%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -1.9e+151) (not (<= c 1.18e-113))) (+ (* 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 <= -1.9e+151) || !(c <= 1.18e-113)) {
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 <= (-1.9d+151)) .or. (.not. (c <= 1.18d-113))) 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 <= -1.9e+151) || !(c <= 1.18e-113)) {
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 <= -1.9e+151) or not (c <= 1.18e-113): 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 ((c <= -1.9e+151) || !(c <= 1.18e-113)) 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 <= -1.9e+151) || ~((c <= 1.18e-113))) 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[c, -1.9e+151], N[Not[LessEqual[c, 1.18e-113]], $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 \leq -1.9 \cdot 10^{+151} \lor \neg \left(c \leq 1.18 \cdot 10^{-113}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if c < -1.9e151 or 1.18e-113 < c Initial program 92.3%
Taylor expanded in x around 0 76.0%
Taylor expanded in a around inf 59.0%
if -1.9e151 < c < 1.18e-113Initial program 96.8%
Taylor expanded in x around 0 74.6%
Taylor expanded in c around 0 63.5%
Final simplification61.2%
(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.5%
Taylor expanded in a around inf 24.9%
Final simplification24.9%
herbie shell --seed 2024044
(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)))