
(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 15 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 96.9%
+-commutative96.9%
fma-def98.0%
associate-+l+98.0%
fma-def99.2%
fma-def99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (+ (+ (* a b) (+ (* z t) (* x y))) (* c i)) INFINITY) (+ (fma x y (* z t)) (+ (* a b) (* c i))) (fma y x (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((((a * b) + ((z * t) + (x * y))) + (c * i)) <= ((double) INFINITY)) {
tmp = fma(x, y, (z * t)) + ((a * b) + (c * i));
} else {
tmp = fma(y, x, (z * t));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) + Float64(c * i)) <= Inf) tmp = Float64(fma(x, y, Float64(z * t)) + Float64(Float64(a * b) + Float64(c * i))); else tmp = fma(y, x, Float64(z * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(a \cdot b + \left(z \cdot t + x \cdot y\right)\right) + c \cdot i \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t\right) + \left(a \cdot b + c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\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%
associate-+l+100.0%
fma-def100.0%
Simplified100.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 0 25.0%
fma-def37.5%
Applied egg-rr37.5%
Taylor expanded in c around 0 62.5%
fma-def75.0%
Simplified75.0%
Final simplification99.2%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (+ (* a b) (+ (* z t) (* x y))) (* c i)))) (if (<= t_1 INFINITY) t_1 (fma y x (* z t)))))
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) + (x * y))) + (c * i);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(y, x, (z * t));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) + Float64(c * i)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(y, x, Float64(z * t)); 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[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(y * x + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot b + \left(z \cdot t + x \cdot y\right)\right) + c \cdot i\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\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 a around 0 25.0%
fma-def37.5%
Applied egg-rr37.5%
Taylor expanded in c around 0 62.5%
fma-def75.0%
Simplified75.0%
Final simplification99.2%
(FPCore (x y z t a b c i) :precision binary64 (fma c i (+ (+ (* a b) (* x y)) (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, (((a * b) + (x * y)) + (z * t)));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, Float64(Float64(Float64(a * b) + Float64(x * y)) + Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \left(a \cdot b + x \cdot y\right) + z \cdot t\right)
\end{array}
Initial program 96.9%
+-commutative96.9%
fma-def98.0%
associate-+l+98.0%
fma-def99.2%
fma-def99.2%
Simplified99.2%
fma-udef98.0%
fma-udef98.0%
associate-+l+98.0%
+-commutative98.0%
associate-+r+98.0%
Applied egg-rr98.0%
Final simplification98.0%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (* z t) (* x y))) (t_2 (+ (+ (* a b) t_1) (* c i)))) (if (<= t_2 INFINITY) t_2 t_1)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (z * t) + (x * y);
double t_2 = ((a * b) + t_1) + (c * i);
double tmp;
if (t_2 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (z * t) + (x * y);
double t_2 = ((a * b) + t_1) + (c * i);
double tmp;
if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (z * t) + (x * y) t_2 = ((a * b) + t_1) + (c * i) tmp = 0 if t_2 <= math.inf: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(z * t) + Float64(x * y)) t_2 = Float64(Float64(Float64(a * b) + t_1) + Float64(c * i)) tmp = 0.0 if (t_2 <= Inf) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (z * t) + (x * y); t_2 = ((a * b) + t_1) + (c * i); tmp = 0.0; if (t_2 <= Inf) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, Infinity], t$95$2, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t + x \cdot y\\
t_2 := \left(a \cdot b + t_1\right) + c \cdot i\\
\mathbf{if}\;t_2 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
Taylor expanded in a around 0 25.0%
Taylor expanded in c around 0 62.5%
Final simplification98.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -1.7e+59) (not (<= (* a b) 1.08e+45))) (+ (* c i) (+ (* a b) (* z t))) (+ (* c i) (+ (* z t) (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -1.7e+59) || !((a * b) <= 1.08e+45)) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = (c * i) + ((z * t) + (x * y));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((a * b) <= (-1.7d+59)) .or. (.not. ((a * b) <= 1.08d+45))) then
tmp = (c * i) + ((a * b) + (z * t))
else
tmp = (c * i) + ((z * t) + (x * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -1.7e+59) || !((a * b) <= 1.08e+45)) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = (c * i) + ((z * t) + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -1.7e+59) or not ((a * b) <= 1.08e+45): tmp = (c * i) + ((a * b) + (z * t)) else: tmp = (c * i) + ((z * t) + (x * y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -1.7e+59) || !(Float64(a * b) <= 1.08e+45)) tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t))); else tmp = Float64(Float64(c * i) + Float64(Float64(z * t) + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((a * b) <= -1.7e+59) || ~(((a * b) <= 1.08e+45))) tmp = (c * i) + ((a * b) + (z * t)); else tmp = (c * i) + ((z * t) + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -1.7e+59], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.08e+45]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.7 \cdot 10^{+59} \lor \neg \left(a \cdot b \leq 1.08 \cdot 10^{+45}\right):\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(z \cdot t + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1.70000000000000003e59 or 1.08e45 < (*.f64 a b) Initial program 92.3%
Taylor expanded in x around 0 87.2%
if -1.70000000000000003e59 < (*.f64 a b) < 1.08e45Initial program 99.4%
Taylor expanded in a around 0 93.0%
Final simplification90.9%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -5.4e+58) (not (<= (* a b) 2.95e+68))) (+ (* a b) (* c i)) (+ (* c i) (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -5.4e+58) || !((a * b) <= 2.95e+68)) {
tmp = (a * b) + (c * i);
} else {
tmp = (c * i) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((a * b) <= (-5.4d+58)) .or. (.not. ((a * b) <= 2.95d+68))) then
tmp = (a * b) + (c * i)
else
tmp = (c * i) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -5.4e+58) || !((a * b) <= 2.95e+68)) {
tmp = (a * b) + (c * i);
} else {
tmp = (c * i) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -5.4e+58) or not ((a * b) <= 2.95e+68): tmp = (a * b) + (c * i) else: tmp = (c * i) + (z * t) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -5.4e+58) || !(Float64(a * b) <= 2.95e+68)) tmp = Float64(Float64(a * b) + Float64(c * i)); else tmp = Float64(Float64(c * i) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((a * b) <= -5.4e+58) || ~(((a * b) <= 2.95e+68))) tmp = (a * b) + (c * i); else tmp = (c * i) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -5.4e+58], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.95e+68]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5.4 \cdot 10^{+58} \lor \neg \left(a \cdot b \leq 2.95 \cdot 10^{+68}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -5.4000000000000002e58 or 2.94999999999999993e68 < (*.f64 a b) Initial program 92.9%
Taylor expanded in a around inf 73.2%
if -5.4000000000000002e58 < (*.f64 a b) < 2.94999999999999993e68Initial program 98.8%
Taylor expanded in z around inf 64.5%
Final simplification67.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= y -1.2e-39) (not (<= y 1.8e+194))) (+ (* z t) (* x y)) (+ (* c i) (+ (* a b) (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((y <= -1.2e-39) || !(y <= 1.8e+194)) {
tmp = (z * t) + (x * y);
} 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 ((y <= (-1.2d-39)) .or. (.not. (y <= 1.8d+194))) then
tmp = (z * t) + (x * y)
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 ((y <= -1.2e-39) || !(y <= 1.8e+194)) {
tmp = (z * t) + (x * y);
} else {
tmp = (c * i) + ((a * b) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (y <= -1.2e-39) or not (y <= 1.8e+194): tmp = (z * t) + (x * y) else: tmp = (c * i) + ((a * b) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((y <= -1.2e-39) || !(y <= 1.8e+194)) tmp = Float64(Float64(z * t) + Float64(x * y)); 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 ((y <= -1.2e-39) || ~((y <= 1.8e+194))) tmp = (z * t) + (x * y); 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[y, -1.2e-39], N[Not[LessEqual[y, 1.8e+194]], $MachinePrecision]], N[(N[(z * t), $MachinePrecision] + N[(x * y), $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}\;y \leq -1.2 \cdot 10^{-39} \lor \neg \left(y \leq 1.8 \cdot 10^{+194}\right):\\
\;\;\;\;z \cdot t + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\end{array}
\end{array}
if y < -1.20000000000000008e-39 or 1.8e194 < y Initial program 94.3%
Taylor expanded in a around 0 77.1%
Taylor expanded in c around 0 62.9%
if -1.20000000000000008e-39 < y < 1.8e194Initial program 98.7%
Taylor expanded in x around 0 86.2%
Final simplification76.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* c i) (* z t))))
(if (<= z -3.4e+111)
t_1
(if (<= z -2.45e-257)
(+ (* a b) (* c i))
(if (<= z 5.5e-17) (+ (* c i) (* x y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + (z * t);
double tmp;
if (z <= -3.4e+111) {
tmp = t_1;
} else if (z <= -2.45e-257) {
tmp = (a * b) + (c * i);
} else if (z <= 5.5e-17) {
tmp = (c * i) + (x * y);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (c * i) + (z * t)
if (z <= (-3.4d+111)) then
tmp = t_1
else if (z <= (-2.45d-257)) then
tmp = (a * b) + (c * i)
else if (z <= 5.5d-17) then
tmp = (c * i) + (x * y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + (z * t);
double tmp;
if (z <= -3.4e+111) {
tmp = t_1;
} else if (z <= -2.45e-257) {
tmp = (a * b) + (c * i);
} else if (z <= 5.5e-17) {
tmp = (c * i) + (x * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + (z * t) tmp = 0 if z <= -3.4e+111: tmp = t_1 elif z <= -2.45e-257: tmp = (a * b) + (c * i) elif z <= 5.5e-17: tmp = (c * i) + (x * y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(z * t)) tmp = 0.0 if (z <= -3.4e+111) tmp = t_1; elseif (z <= -2.45e-257) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (z <= 5.5e-17) tmp = Float64(Float64(c * i) + Float64(x * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (c * i) + (z * t); tmp = 0.0; if (z <= -3.4e+111) tmp = t_1; elseif (z <= -2.45e-257) tmp = (a * b) + (c * i); elseif (z <= 5.5e-17) tmp = (c * i) + (x * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.4e+111], t$95$1, If[LessEqual[z, -2.45e-257], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e-17], N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+111}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.45 \cdot 10^{-257}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-17}:\\
\;\;\;\;c \cdot i + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -3.4000000000000001e111 or 5.50000000000000001e-17 < z Initial program 96.4%
Taylor expanded in z around inf 68.0%
if -3.4000000000000001e111 < z < -2.45000000000000006e-257Initial program 97.6%
Taylor expanded in a around inf 57.2%
if -2.45000000000000006e-257 < z < 5.50000000000000001e-17Initial program 96.7%
Taylor expanded in x around inf 61.1%
Final simplification62.9%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= t -8.8e-27) (not (<= t 2.5e+172))) (* 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 ((t <= -8.8e-27) || !(t <= 2.5e+172)) {
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 ((t <= (-8.8d-27)) .or. (.not. (t <= 2.5d+172))) 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 ((t <= -8.8e-27) || !(t <= 2.5e+172)) {
tmp = z * t;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (t <= -8.8e-27) or not (t <= 2.5e+172): 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 ((t <= -8.8e-27) || !(t <= 2.5e+172)) 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 ((t <= -8.8e-27) || ~((t <= 2.5e+172))) 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[t, -8.8e-27], N[Not[LessEqual[t, 2.5e+172]], $MachinePrecision]], N[(z * t), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{-27} \lor \neg \left(t \leq 2.5 \cdot 10^{+172}\right):\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if t < -8.79999999999999948e-27 or 2.5e172 < t Initial program 95.9%
Taylor expanded in a around 0 81.4%
Taylor expanded in t around inf 55.7%
if -8.79999999999999948e-27 < t < 2.5e172Initial program 97.4%
Taylor expanded in a around inf 57.8%
Final simplification57.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -3.5e+33) (* c i) (if (<= (* c i) 7e+115) (* 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) <= -3.5e+33) {
tmp = c * i;
} else if ((c * i) <= 7e+115) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((c * i) <= (-3.5d+33)) then
tmp = c * i
else if ((c * i) <= 7d+115) then
tmp = a * b
else
tmp = c * i
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -3.5e+33) {
tmp = c * i;
} else if ((c * i) <= 7e+115) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -3.5e+33: tmp = c * i elif (c * i) <= 7e+115: tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -3.5e+33) tmp = Float64(c * i); elseif (Float64(c * i) <= 7e+115) tmp = Float64(a * b); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -3.5e+33) tmp = c * i; elseif ((c * i) <= 7e+115) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -3.5e+33], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 7e+115], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.5 \cdot 10^{+33}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 7 \cdot 10^{+115}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -3.5000000000000001e33 or 7.00000000000000011e115 < (*.f64 c i) Initial program 95.3%
Taylor expanded in c around inf 55.6%
if -3.5000000000000001e33 < (*.f64 c i) < 7.00000000000000011e115Initial program 97.6%
Taylor expanded in x around 0 73.4%
Taylor expanded in t around 0 39.8%
Taylor expanded in c around 0 36.1%
Final simplification42.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= b -3.6e-37) (* a b) (if (<= b 2.5e+164) (+ (* z t) (* 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 (b <= -3.6e-37) {
tmp = a * b;
} else if (b <= 2.5e+164) {
tmp = (z * t) + (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 (b <= (-3.6d-37)) then
tmp = a * b
else if (b <= 2.5d+164) then
tmp = (z * t) + (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 (b <= -3.6e-37) {
tmp = a * b;
} else if (b <= 2.5e+164) {
tmp = (z * t) + (x * y);
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if b <= -3.6e-37: tmp = a * b elif b <= 2.5e+164: tmp = (z * t) + (x * y) else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (b <= -3.6e-37) tmp = Float64(a * b); elseif (b <= 2.5e+164) tmp = Float64(Float64(z * t) + 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 (b <= -3.6e-37) tmp = a * b; elseif (b <= 2.5e+164) tmp = (z * t) + (x * y); else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[b, -3.6e-37], N[(a * b), $MachinePrecision], If[LessEqual[b, 2.5e+164], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.6 \cdot 10^{-37}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;b \leq 2.5 \cdot 10^{+164}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if b < -3.60000000000000007e-37Initial program 96.5%
Taylor expanded in x around 0 88.3%
Taylor expanded in t around 0 64.9%
Taylor expanded in c around 0 49.6%
if -3.60000000000000007e-37 < b < 2.49999999999999975e164Initial program 97.7%
Taylor expanded in a around 0 86.0%
Taylor expanded in c around 0 67.0%
if 2.49999999999999975e164 < b Initial program 92.3%
Taylor expanded in a around inf 75.8%
Final simplification63.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= z -3.8e+111) (* z t) (if (<= z -1.4e-257) (* a b) (if (<= z 5e-19) (* x y) (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (z <= -3.8e+111) {
tmp = z * t;
} else if (z <= -1.4e-257) {
tmp = a * b;
} else if (z <= 5e-19) {
tmp = x * y;
} 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 <= (-3.8d+111)) then
tmp = z * t
else if (z <= (-1.4d-257)) then
tmp = a * b
else if (z <= 5d-19) then
tmp = x * y
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 <= -3.8e+111) {
tmp = z * t;
} else if (z <= -1.4e-257) {
tmp = a * b;
} else if (z <= 5e-19) {
tmp = x * y;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if z <= -3.8e+111: tmp = z * t elif z <= -1.4e-257: tmp = a * b elif z <= 5e-19: tmp = x * y else: tmp = z * t return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (z <= -3.8e+111) tmp = Float64(z * t); elseif (z <= -1.4e-257) tmp = Float64(a * b); elseif (z <= 5e-19) tmp = Float64(x * y); 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 <= -3.8e+111) tmp = z * t; elseif (z <= -1.4e-257) tmp = a * b; elseif (z <= 5e-19) tmp = x * y; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -3.8e+111], N[(z * t), $MachinePrecision], If[LessEqual[z, -1.4e-257], N[(a * b), $MachinePrecision], If[LessEqual[z, 5e-19], N[(x * y), $MachinePrecision], N[(z * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+111}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \leq -1.4 \cdot 10^{-257}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-19}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if z < -3.79999999999999976e111 or 5.0000000000000004e-19 < z Initial program 96.4%
Taylor expanded in a around 0 82.1%
Taylor expanded in t around inf 56.7%
if -3.79999999999999976e111 < z < -1.40000000000000001e-257Initial program 97.6%
Taylor expanded in x around 0 76.8%
Taylor expanded in t around 0 57.2%
Taylor expanded in c around 0 31.6%
if -1.40000000000000001e-257 < z < 5.0000000000000004e-19Initial program 96.7%
Taylor expanded in a around 0 68.7%
Taylor expanded in y around inf 40.9%
Final simplification44.8%
(FPCore (x y z t a b c i) :precision binary64 (if (<= z -3e+111) (* z t) (if (<= z 1.1e-22) (* 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 <= -3e+111) {
tmp = z * t;
} else if (z <= 1.1e-22) {
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 <= (-3d+111)) then
tmp = z * t
else if (z <= 1.1d-22) 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 <= -3e+111) {
tmp = z * t;
} else if (z <= 1.1e-22) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if z <= -3e+111: tmp = z * t elif z <= 1.1e-22: tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (z <= -3e+111) tmp = Float64(z * t); elseif (z <= 1.1e-22) 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 <= -3e+111) tmp = z * t; elseif (z <= 1.1e-22) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -3e+111], N[(z * t), $MachinePrecision], If[LessEqual[z, 1.1e-22], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+111}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-22}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if z < -3e111 or 1.1e-22 < z Initial program 96.4%
Taylor expanded in a around 0 82.1%
Taylor expanded in t around inf 56.7%
if -3e111 < z < 1.1e-22Initial program 97.2%
Taylor expanded in x around 0 70.7%
Taylor expanded in t around 0 56.2%
Taylor expanded in c around 0 33.2%
Final simplification43.5%
(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 96.9%
Taylor expanded in x around 0 76.3%
Taylor expanded in t around 0 48.0%
Taylor expanded in c around 0 28.1%
Final simplification28.1%
herbie shell --seed 2023199
(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)))