
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x * y) + (z * t)) + (a * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b): return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * t)) + (a * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z \cdot t\right) + a \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x * y) + (z * t)) + (a * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b): return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * t)) + (a * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z \cdot t\right) + a \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (* x y) (* z t)) 2e+305) (fma x y (fma z t (* a b))) (* y (+ x (* t (/ z y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) + (z * t)) <= 2e+305) {
tmp = fma(x, y, fma(z, t, (a * b)));
} else {
tmp = y * (x + (t * (z / y)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(x * y) + Float64(z * t)) <= 2e+305) tmp = fma(x, y, fma(z, t, Float64(a * b))); else tmp = Float64(y * Float64(x + Float64(t * Float64(z / y)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], 2e+305], N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + N[(t * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y + z \cdot t \leq 2 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + t \cdot \frac{z}{y}\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < 1.9999999999999999e305Initial program 98.6%
associate-+l+98.6%
fma-define99.5%
fma-define99.5%
Simplified99.5%
if 1.9999999999999999e305 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 83.8%
Taylor expanded in a around 0 89.2%
Taylor expanded in y around inf 91.9%
associate-/l*100.0%
Simplified100.0%
Final simplification99.6%
(FPCore (x y z t a b) :precision binary64 (fma a b (fma x y (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(a, b, fma(x, y, (z * t)));
}
function code(x, y, z, t, a, b) return fma(a, b, fma(x, y, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)
\end{array}
Initial program 96.5%
+-commutative96.5%
fma-define97.6%
fma-define98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (+ (* x y) (* z t)) (* a b)) INFINITY) (+ (* a b) (fma x y (* z t))) (* y (+ x (* t (/ z y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((((x * y) + (z * t)) + (a * b)) <= ((double) INFINITY)) {
tmp = (a * b) + fma(x, y, (z * t));
} else {
tmp = y * (x + (t * (z / y)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) <= Inf) tmp = Float64(Float64(a * b) + fma(x, y, Float64(z * t))); else tmp = Float64(y * Float64(x + Float64(t * Float64(z / y)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(a * b), $MachinePrecision] + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + N[(t * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot y + z \cdot t\right) + a \cdot b \leq \infty:\\
\;\;\;\;a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + t \cdot \frac{z}{y}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
fma-define100.0%
Simplified100.0%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in a around 0 33.3%
Taylor expanded in y around inf 44.4%
associate-/l*77.8%
Simplified77.8%
Final simplification99.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -2.75e+91)
(* x y)
(if (<= (* x y) -1e-161)
(* a b)
(if (<= (* x y) -2.2e-241)
(* z t)
(if (<= (* x y) 2.3e-272)
(* a b)
(if (<= (* x y) 8.5e+59) (* z t) (* x y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -2.75e+91) {
tmp = x * y;
} else if ((x * y) <= -1e-161) {
tmp = a * b;
} else if ((x * y) <= -2.2e-241) {
tmp = z * t;
} else if ((x * y) <= 2.3e-272) {
tmp = a * b;
} else if ((x * y) <= 8.5e+59) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((x * y) <= (-2.75d+91)) then
tmp = x * y
else if ((x * y) <= (-1d-161)) then
tmp = a * b
else if ((x * y) <= (-2.2d-241)) then
tmp = z * t
else if ((x * y) <= 2.3d-272) then
tmp = a * b
else if ((x * y) <= 8.5d+59) then
tmp = z * t
else
tmp = 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 tmp;
if ((x * y) <= -2.75e+91) {
tmp = x * y;
} else if ((x * y) <= -1e-161) {
tmp = a * b;
} else if ((x * y) <= -2.2e-241) {
tmp = z * t;
} else if ((x * y) <= 2.3e-272) {
tmp = a * b;
} else if ((x * y) <= 8.5e+59) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -2.75e+91: tmp = x * y elif (x * y) <= -1e-161: tmp = a * b elif (x * y) <= -2.2e-241: tmp = z * t elif (x * y) <= 2.3e-272: tmp = a * b elif (x * y) <= 8.5e+59: tmp = z * t else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -2.75e+91) tmp = Float64(x * y); elseif (Float64(x * y) <= -1e-161) tmp = Float64(a * b); elseif (Float64(x * y) <= -2.2e-241) tmp = Float64(z * t); elseif (Float64(x * y) <= 2.3e-272) tmp = Float64(a * b); elseif (Float64(x * y) <= 8.5e+59) tmp = Float64(z * t); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -2.75e+91) tmp = x * y; elseif ((x * y) <= -1e-161) tmp = a * b; elseif ((x * y) <= -2.2e-241) tmp = z * t; elseif ((x * y) <= 2.3e-272) tmp = a * b; elseif ((x * y) <= 8.5e+59) tmp = z * t; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -2.75e+91], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1e-161], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2.2e-241], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.3e-272], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 8.5e+59], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.75 \cdot 10^{+91}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-161}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq -2.2 \cdot 10^{-241}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 2.3 \cdot 10^{-272}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 8.5 \cdot 10^{+59}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -2.7499999999999999e91 or 8.4999999999999999e59 < (*.f64 x y) Initial program 94.0%
Taylor expanded in x around inf 67.8%
if -2.7499999999999999e91 < (*.f64 x y) < -1.00000000000000003e-161 or -2.1999999999999999e-241 < (*.f64 x y) < 2.29999999999999989e-272Initial program 98.7%
Taylor expanded in a around inf 61.2%
if -1.00000000000000003e-161 < (*.f64 x y) < -2.1999999999999999e-241 or 2.29999999999999989e-272 < (*.f64 x y) < 8.4999999999999999e59Initial program 97.4%
Taylor expanded in z around inf 60.4%
Final simplification63.5%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= (* a b) -6.2e+103)
(not
(or (<= (* a b) 4.6e-13)
(and (not (<= (* a b) 4.8e+86)) (<= (* a b) 2.2e+217)))))
(* a b)
(* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -6.2e+103) || !(((a * b) <= 4.6e-13) || (!((a * b) <= 4.8e+86) && ((a * b) <= 2.2e+217)))) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (((a * b) <= (-6.2d+103)) .or. (.not. ((a * b) <= 4.6d-13) .or. (.not. ((a * b) <= 4.8d+86)) .and. ((a * b) <= 2.2d+217))) 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 tmp;
if (((a * b) <= -6.2e+103) || !(((a * b) <= 4.6e-13) || (!((a * b) <= 4.8e+86) && ((a * b) <= 2.2e+217)))) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -6.2e+103) or not (((a * b) <= 4.6e-13) or (not ((a * b) <= 4.8e+86) and ((a * b) <= 2.2e+217))): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -6.2e+103) || !((Float64(a * b) <= 4.6e-13) || (!(Float64(a * b) <= 4.8e+86) && (Float64(a * b) <= 2.2e+217)))) tmp = Float64(a * b); else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((a * b) <= -6.2e+103) || ~((((a * b) <= 4.6e-13) || (~(((a * b) <= 4.8e+86)) && ((a * b) <= 2.2e+217))))) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -6.2e+103], N[Not[Or[LessEqual[N[(a * b), $MachinePrecision], 4.6e-13], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], 4.8e+86]], $MachinePrecision], LessEqual[N[(a * b), $MachinePrecision], 2.2e+217]]]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.2 \cdot 10^{+103} \lor \neg \left(a \cdot b \leq 4.6 \cdot 10^{-13} \lor \neg \left(a \cdot b \leq 4.8 \cdot 10^{+86}\right) \land a \cdot b \leq 2.2 \cdot 10^{+217}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -6.2000000000000003e103 or 4.59999999999999958e-13 < (*.f64 a b) < 4.8000000000000001e86 or 2.2e217 < (*.f64 a b) Initial program 94.6%
Taylor expanded in a around inf 76.1%
if -6.2000000000000003e103 < (*.f64 a b) < 4.59999999999999958e-13 or 4.8000000000000001e86 < (*.f64 a b) < 2.2e217Initial program 97.5%
Taylor expanded in z around inf 50.1%
Final simplification59.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (* x y) (* z t)) (* a b)))) (if (<= t_1 INFINITY) t_1 (* y (+ x (* t (/ z y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x * y) + (z * t)) + (a * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = y * (x + (t * (z / y)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x * y) + (z * t)) + (a * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = y * (x + (t * (z / y)));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((x * y) + (z * t)) + (a * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = y * (x + (t * (z / y))) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(y * Float64(x + Float64(t * Float64(z / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((x * y) + (z * t)) + (a * b); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = y * (x + (t * (z / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(y * N[(x + N[(t * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y + z \cdot t\right) + a \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + t \cdot \frac{z}{y}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in a around 0 33.3%
Taylor expanded in y around inf 44.4%
associate-/l*77.8%
Simplified77.8%
Final simplification99.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -1e+90) (not (<= (* x y) 1e+58))) (* y (+ x (* t (/ z y)))) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -1e+90) || !((x * y) <= 1e+58)) {
tmp = y * (x + (t * (z / y)));
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (((x * y) <= (-1d+90)) .or. (.not. ((x * y) <= 1d+58))) then
tmp = y * (x + (t * (z / y)))
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 tmp;
if (((x * y) <= -1e+90) || !((x * y) <= 1e+58)) {
tmp = y * (x + (t * (z / y)));
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -1e+90) or not ((x * y) <= 1e+58): tmp = y * (x + (t * (z / y))) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(x * y) <= -1e+90) || !(Float64(x * y) <= 1e+58)) tmp = Float64(y * Float64(x + Float64(t * Float64(z / y)))); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((x * y) <= -1e+90) || ~(((x * y) <= 1e+58))) tmp = y * (x + (t * (z / y))); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+90], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+58]], $MachinePrecision]], N[(y * N[(x + N[(t * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+90} \lor \neg \left(x \cdot y \leq 10^{+58}\right):\\
\;\;\;\;y \cdot \left(x + t \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999966e89 or 9.99999999999999944e57 < (*.f64 x y) Initial program 94.1%
Taylor expanded in a around 0 81.0%
Taylor expanded in y around inf 80.2%
associate-/l*80.3%
Simplified80.3%
if -9.99999999999999966e89 < (*.f64 x y) < 9.99999999999999944e57Initial program 98.0%
Taylor expanded in x around 0 90.9%
Final simplification86.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -8e+201) (not (<= (* x y) 1.2e+194))) (* x y) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -8e+201) || !((x * y) <= 1.2e+194)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (((x * y) <= (-8d+201)) .or. (.not. ((x * y) <= 1.2d+194))) then
tmp = x * y
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 tmp;
if (((x * y) <= -8e+201) || !((x * y) <= 1.2e+194)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -8e+201) or not ((x * y) <= 1.2e+194): tmp = x * y else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(x * y) <= -8e+201) || !(Float64(x * y) <= 1.2e+194)) tmp = Float64(x * y); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((x * y) <= -8e+201) || ~(((x * y) <= 1.2e+194))) tmp = x * y; else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -8e+201], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.2e+194]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -8 \cdot 10^{+201} \lor \neg \left(x \cdot y \leq 1.2 \cdot 10^{+194}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -8.0000000000000003e201 or 1.2e194 < (*.f64 x y) Initial program 89.5%
Taylor expanded in x around inf 88.0%
if -8.0000000000000003e201 < (*.f64 x y) < 1.2e194Initial program 98.5%
Taylor expanded in x around 0 84.2%
Final simplification85.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -3.4e+192) (not (<= (* x y) 2.3e+59))) (+ (* x y) (* a b)) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -3.4e+192) || !((x * y) <= 2.3e+59)) {
tmp = (x * y) + (a * b);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (((x * y) <= (-3.4d+192)) .or. (.not. ((x * y) <= 2.3d+59))) then
tmp = (x * y) + (a * b)
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 tmp;
if (((x * y) <= -3.4e+192) || !((x * y) <= 2.3e+59)) {
tmp = (x * y) + (a * b);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -3.4e+192) or not ((x * y) <= 2.3e+59): tmp = (x * y) + (a * b) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(x * y) <= -3.4e+192) || !(Float64(x * y) <= 2.3e+59)) tmp = Float64(Float64(x * y) + Float64(a * b)); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((x * y) <= -3.4e+192) || ~(((x * y) <= 2.3e+59))) tmp = (x * y) + (a * b); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -3.4e+192], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.3e+59]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.4 \cdot 10^{+192} \lor \neg \left(x \cdot y \leq 2.3 \cdot 10^{+59}\right):\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -3.39999999999999996e192 or 2.30000000000000008e59 < (*.f64 x y) Initial program 92.7%
Taylor expanded in z around 0 84.6%
if -3.39999999999999996e192 < (*.f64 x y) < 2.30000000000000008e59Initial program 98.2%
Taylor expanded in x around 0 88.0%
Final simplification86.9%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -3.4e+192) (+ (* x y) (* a b)) (if (<= (* x y) 2.2e+51) (+ (* a b) (* z t)) (+ (* x y) (* z t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -3.4e+192) {
tmp = (x * y) + (a * b);
} else if ((x * y) <= 2.2e+51) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((x * y) <= (-3.4d+192)) then
tmp = (x * y) + (a * b)
else if ((x * y) <= 2.2d+51) then
tmp = (a * b) + (z * t)
else
tmp = (x * y) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -3.4e+192) {
tmp = (x * y) + (a * b);
} else if ((x * y) <= 2.2e+51) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -3.4e+192: tmp = (x * y) + (a * b) elif (x * y) <= 2.2e+51: tmp = (a * b) + (z * t) else: tmp = (x * y) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -3.4e+192) tmp = Float64(Float64(x * y) + Float64(a * b)); elseif (Float64(x * y) <= 2.2e+51) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(Float64(x * y) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -3.4e+192) tmp = (x * y) + (a * b); elseif ((x * y) <= 2.2e+51) tmp = (a * b) + (z * t); else tmp = (x * y) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -3.4e+192], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.2e+51], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.4 \cdot 10^{+192}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 2.2 \cdot 10^{+51}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -3.39999999999999996e192Initial program 84.8%
Taylor expanded in z around 0 85.1%
if -3.39999999999999996e192 < (*.f64 x y) < 2.19999999999999992e51Initial program 98.2%
Taylor expanded in x around 0 87.9%
if 2.19999999999999992e51 < (*.f64 x y) Initial program 98.0%
Taylor expanded in a around 0 86.6%
Final simplification87.3%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -5e+198) (* x (+ y (/ (* a b) x))) (if (<= (* x y) 2e+49) (+ (* a b) (* z t)) (+ (* x y) (* z t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -5e+198) {
tmp = x * (y + ((a * b) / x));
} else if ((x * y) <= 2e+49) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((x * y) <= (-5d+198)) then
tmp = x * (y + ((a * b) / x))
else if ((x * y) <= 2d+49) then
tmp = (a * b) + (z * t)
else
tmp = (x * y) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -5e+198) {
tmp = x * (y + ((a * b) / x));
} else if ((x * y) <= 2e+49) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -5e+198: tmp = x * (y + ((a * b) / x)) elif (x * y) <= 2e+49: tmp = (a * b) + (z * t) else: tmp = (x * y) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -5e+198) tmp = Float64(x * Float64(y + Float64(Float64(a * b) / x))); elseif (Float64(x * y) <= 2e+49) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(Float64(x * y) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -5e+198) tmp = x * (y + ((a * b) / x)); elseif ((x * y) <= 2e+49) tmp = (a * b) + (z * t); else tmp = (x * y) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+198], N[(x * N[(y + N[(N[(a * b), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+49], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+198}:\\
\;\;\;\;x \cdot \left(y + \frac{a \cdot b}{x}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+49}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000049e198Initial program 84.8%
Taylor expanded in z around 0 85.1%
Taylor expanded in x around inf 91.2%
if -5.00000000000000049e198 < (*.f64 x y) < 1.99999999999999989e49Initial program 98.2%
Taylor expanded in x around 0 87.9%
if 1.99999999999999989e49 < (*.f64 x y) Initial program 98.0%
Taylor expanded in a around 0 86.6%
Final simplification88.0%
(FPCore (x y z t a b) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
real(8) function code(x, y, z, t, a, b)
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
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
def code(x, y, z, t, a, b): return a * b
function code(x, y, z, t, a, b) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 96.5%
Taylor expanded in a around inf 36.1%
Final simplification36.1%
herbie shell --seed 2024080
(FPCore (x y z t a b)
:name "Linear.V3:$cdot from linear-1.19.1.3, B"
:precision binary64
(+ (+ (* x y) (* z t)) (* a b)))