
(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 11 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 (let* ((t_1 (+ (* a b) (+ (* x y) (* z t))))) (if (<= t_1 INFINITY) t_1 (* a (+ b (/ (* x y) a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + ((x * y) + (z * t));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = a * (b + ((x * y) / a));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + ((x * y) + (z * t));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = a * (b + ((x * y) / a));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * b) + ((x * y) + (z * t)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = a * (b + ((x * y) / a)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(a * Float64(b + Float64(Float64(x * y) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * b) + ((x * y) + (z * t)); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = a * (b + ((x * y) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(a * N[(b + N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(b + \frac{x \cdot y}{a}\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 x around inf 57.1%
Taylor expanded in a around inf 71.4%
Final simplification99.2%
(FPCore (x y z t a b) :precision binary64 (fma x y (fma z t (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(z, t, (a * b)));
}
function code(x, y, z, t, a, b) return fma(x, y, fma(z, t, Float64(a * b))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)
\end{array}
Initial program 97.2%
associate-+l+97.2%
fma-define98.0%
fma-define98.4%
Simplified98.4%
Final simplification98.4%
(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 97.2%
+-commutative97.2%
fma-define97.6%
fma-define98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (fma x y (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + fma(x, y, (z * t));
}
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + fma(x, y, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)
\end{array}
Initial program 97.2%
fma-define97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -2e+71)
(* a b)
(if (<= (* a b) -2e-135)
(* x y)
(if (<= (* a b) -2e-151)
(* z t)
(if (<= (* a b) -5e-211)
(* x y)
(if (<= (* a b) 2e-239)
(* z t)
(if (<= (* a b) 1e+143) (* x y) (* a b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2e+71) {
tmp = a * b;
} else if ((a * b) <= -2e-135) {
tmp = x * y;
} else if ((a * b) <= -2e-151) {
tmp = z * t;
} else if ((a * b) <= -5e-211) {
tmp = x * y;
} else if ((a * b) <= 2e-239) {
tmp = z * t;
} else if ((a * b) <= 1e+143) {
tmp = x * y;
} else {
tmp = a * b;
}
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) <= (-2d+71)) then
tmp = a * b
else if ((a * b) <= (-2d-135)) then
tmp = x * y
else if ((a * b) <= (-2d-151)) then
tmp = z * t
else if ((a * b) <= (-5d-211)) then
tmp = x * y
else if ((a * b) <= 2d-239) then
tmp = z * t
else if ((a * b) <= 1d+143) then
tmp = x * y
else
tmp = a * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2e+71) {
tmp = a * b;
} else if ((a * b) <= -2e-135) {
tmp = x * y;
} else if ((a * b) <= -2e-151) {
tmp = z * t;
} else if ((a * b) <= -5e-211) {
tmp = x * y;
} else if ((a * b) <= 2e-239) {
tmp = z * t;
} else if ((a * b) <= 1e+143) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -2e+71: tmp = a * b elif (a * b) <= -2e-135: tmp = x * y elif (a * b) <= -2e-151: tmp = z * t elif (a * b) <= -5e-211: tmp = x * y elif (a * b) <= 2e-239: tmp = z * t elif (a * b) <= 1e+143: tmp = x * y else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -2e+71) tmp = Float64(a * b); elseif (Float64(a * b) <= -2e-135) tmp = Float64(x * y); elseif (Float64(a * b) <= -2e-151) tmp = Float64(z * t); elseif (Float64(a * b) <= -5e-211) tmp = Float64(x * y); elseif (Float64(a * b) <= 2e-239) tmp = Float64(z * t); elseif (Float64(a * b) <= 1e+143) tmp = Float64(x * y); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a * b) <= -2e+71) tmp = a * b; elseif ((a * b) <= -2e-135) tmp = x * y; elseif ((a * b) <= -2e-151) tmp = z * t; elseif ((a * b) <= -5e-211) tmp = x * y; elseif ((a * b) <= 2e-239) tmp = z * t; elseif ((a * b) <= 1e+143) tmp = x * y; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e+71], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2e-135], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2e-151], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -5e-211], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e-239], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+143], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+71}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{-135}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{-151}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-211}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-239}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 10^{+143}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -2.0000000000000001e71 or 1e143 < (*.f64 a b) Initial program 95.4%
Taylor expanded in a around inf 82.9%
if -2.0000000000000001e71 < (*.f64 a b) < -2.0000000000000001e-135 or -1.9999999999999999e-151 < (*.f64 a b) < -5.0000000000000002e-211 or 2.0000000000000002e-239 < (*.f64 a b) < 1e143Initial program 97.9%
Taylor expanded in x around inf 70.5%
Taylor expanded in a around inf 60.8%
Taylor expanded in a around 0 56.4%
if -2.0000000000000001e-135 < (*.f64 a b) < -1.9999999999999999e-151 or -5.0000000000000002e-211 < (*.f64 a b) < 2.0000000000000002e-239Initial program 98.6%
Taylor expanded in x around 0 65.4%
Taylor expanded in b around inf 38.2%
associate-/l*38.6%
Simplified38.6%
Taylor expanded in b around 0 65.4%
Final simplification68.1%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -2e+71) (+ (* a b) (* x y)) (if (<= (* a b) 5e+125) (+ (* x y) (* z t)) (* b (+ a (* t (/ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2e+71) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 5e+125) {
tmp = (x * y) + (z * t);
} else {
tmp = b * (a + (t * (z / b)));
}
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) <= (-2d+71)) then
tmp = (a * b) + (x * y)
else if ((a * b) <= 5d+125) then
tmp = (x * y) + (z * t)
else
tmp = b * (a + (t * (z / b)))
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) <= -2e+71) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 5e+125) {
tmp = (x * y) + (z * t);
} else {
tmp = b * (a + (t * (z / b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -2e+71: tmp = (a * b) + (x * y) elif (a * b) <= 5e+125: tmp = (x * y) + (z * t) else: tmp = b * (a + (t * (z / b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -2e+71) tmp = Float64(Float64(a * b) + Float64(x * y)); elseif (Float64(a * b) <= 5e+125) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(b * Float64(a + Float64(t * Float64(z / b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a * b) <= -2e+71) tmp = (a * b) + (x * y); elseif ((a * b) <= 5e+125) tmp = (x * y) + (z * t); else tmp = b * (a + (t * (z / b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e+71], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+125], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(b * N[(a + N[(t * N[(z / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+71}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+125}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a + t \cdot \frac{z}{b}\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -2.0000000000000001e71Initial program 98.0%
Taylor expanded in x around inf 93.6%
if -2.0000000000000001e71 < (*.f64 a b) < 4.99999999999999962e125Initial program 98.2%
+-commutative98.2%
fma-define98.2%
fma-define98.8%
Simplified98.8%
fma-define98.2%
+-commutative98.2%
Applied egg-rr98.2%
Taylor expanded in t around inf 87.6%
Taylor expanded in x around 0 97.6%
Taylor expanded in t around inf 90.2%
if 4.99999999999999962e125 < (*.f64 a b) Initial program 92.1%
Taylor expanded in x around 0 94.7%
Taylor expanded in b around inf 94.7%
associate-/l*94.8%
Simplified94.8%
Final simplification91.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -3.8e+257) (not (<= (* x y) 2.6e+110))) (* 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) <= -3.8e+257) || !((x * y) <= 2.6e+110)) {
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) <= (-3.8d+257)) .or. (.not. ((x * y) <= 2.6d+110))) 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) <= -3.8e+257) || !((x * y) <= 2.6e+110)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -3.8e+257) or not ((x * y) <= 2.6e+110): 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) <= -3.8e+257) || !(Float64(x * y) <= 2.6e+110)) 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) <= -3.8e+257) || ~(((x * y) <= 2.6e+110))) 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], -3.8e+257], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.6e+110]], $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 -3.8 \cdot 10^{+257} \lor \neg \left(x \cdot y \leq 2.6 \cdot 10^{+110}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -3.79999999999999998e257 or 2.6e110 < (*.f64 x y) Initial program 91.1%
Taylor expanded in x around inf 87.5%
Taylor expanded in a around inf 74.1%
Taylor expanded in a around 0 80.3%
if -3.79999999999999998e257 < (*.f64 x y) < 2.6e110Initial program 99.4%
Taylor expanded in x around 0 81.6%
Final simplification81.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -2e+71) (not (<= (* a b) 5e+125))) (+ (* 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 (((a * b) <= -2e+71) || !((a * b) <= 5e+125)) {
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 (((a * b) <= (-2d+71)) .or. (.not. ((a * b) <= 5d+125))) 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 (((a * b) <= -2e+71) || !((a * b) <= 5e+125)) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -2e+71) or not ((a * b) <= 5e+125): 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(a * b) <= -2e+71) || !(Float64(a * b) <= 5e+125)) 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 (((a * b) <= -2e+71) || ~(((a * b) <= 5e+125))) tmp = (a * b) + (z * t); else tmp = (x * y) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -2e+71], N[Not[LessEqual[N[(a * b), $MachinePrecision], 5e+125]], $MachinePrecision]], 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}\;a \cdot b \leq -2 \cdot 10^{+71} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+125}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -2.0000000000000001e71 or 4.99999999999999962e125 < (*.f64 a b) Initial program 95.5%
Taylor expanded in x around 0 90.3%
if -2.0000000000000001e71 < (*.f64 a b) < 4.99999999999999962e125Initial program 98.2%
+-commutative98.2%
fma-define98.2%
fma-define98.8%
Simplified98.8%
fma-define98.2%
+-commutative98.2%
Applied egg-rr98.2%
Taylor expanded in t around inf 87.6%
Taylor expanded in x around 0 97.6%
Taylor expanded in t around inf 90.2%
Final simplification90.2%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -2e+71) (+ (* a b) (* x y)) (if (<= (* a b) 5e+125) (+ (* x y) (* z t)) (+ (* a b) (* z t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2e+71) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 5e+125) {
tmp = (x * y) + (z * t);
} 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 ((a * b) <= (-2d+71)) then
tmp = (a * b) + (x * y)
else if ((a * b) <= 5d+125) then
tmp = (x * y) + (z * t)
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 ((a * b) <= -2e+71) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 5e+125) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -2e+71: tmp = (a * b) + (x * y) elif (a * b) <= 5e+125: tmp = (x * y) + (z * t) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -2e+71) tmp = Float64(Float64(a * b) + Float64(x * y)); elseif (Float64(a * b) <= 5e+125) tmp = Float64(Float64(x * y) + Float64(z * t)); 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 ((a * b) <= -2e+71) tmp = (a * b) + (x * y); elseif ((a * b) <= 5e+125) tmp = (x * y) + (z * t); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e+71], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+125], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+71}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+125}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -2.0000000000000001e71Initial program 98.0%
Taylor expanded in x around inf 93.6%
if -2.0000000000000001e71 < (*.f64 a b) < 4.99999999999999962e125Initial program 98.2%
+-commutative98.2%
fma-define98.2%
fma-define98.8%
Simplified98.8%
fma-define98.2%
+-commutative98.2%
Applied egg-rr98.2%
Taylor expanded in t around inf 87.6%
Taylor expanded in x around 0 97.6%
Taylor expanded in t around inf 90.2%
if 4.99999999999999962e125 < (*.f64 a b) Initial program 92.1%
Taylor expanded in x around 0 94.7%
Final simplification91.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -1.2e+71) (not (<= (* a b) 6.8e+75))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -1.2e+71) || !((a * b) <= 6.8e+75)) {
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) <= (-1.2d+71)) .or. (.not. ((a * b) <= 6.8d+75))) 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) <= -1.2e+71) || !((a * b) <= 6.8e+75)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -1.2e+71) or not ((a * b) <= 6.8e+75): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -1.2e+71) || !(Float64(a * b) <= 6.8e+75)) 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) <= -1.2e+71) || ~(((a * b) <= 6.8e+75))) 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], -1.2e+71], N[Not[LessEqual[N[(a * b), $MachinePrecision], 6.8e+75]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.2 \cdot 10^{+71} \lor \neg \left(a \cdot b \leq 6.8 \cdot 10^{+75}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -1.1999999999999999e71 or 6.80000000000000022e75 < (*.f64 a b) Initial program 95.8%
Taylor expanded in a around inf 78.3%
if -1.1999999999999999e71 < (*.f64 a b) < 6.80000000000000022e75Initial program 98.1%
Taylor expanded in x around 0 53.6%
Taylor expanded in b around inf 40.0%
associate-/l*40.1%
Simplified40.1%
Taylor expanded in b around 0 46.7%
Final simplification58.5%
(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 97.2%
Taylor expanded in a around inf 35.2%
Final simplification35.2%
herbie shell --seed 2024071
(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)))