
(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 10 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 (* z (+ t (* x (/ y z)))))))
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 = z * (t + (x * (y / z)));
}
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 = z * (t + (x * (y / z)));
}
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 = z * (t + (x * (y / z))) 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(z * Float64(t + Float64(x * Float64(y / z)))); 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 = z * (t + (x * (y / z))); 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[(z * N[(t + N[(x * N[(y / z), $MachinePrecision]), $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}:\\
\;\;\;\;z \cdot \left(t + x \cdot \frac{y}{z}\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 t around inf 20.0%
Taylor expanded in a around 0 40.0%
Taylor expanded in z around inf 40.0%
associate-/l*100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t a b) :precision binary64 (fma x y (fma a b (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(a, b, (z * t)));
}
function code(x, y, z, t, a, b) return fma(x, y, fma(a, b, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\right)\right)
\end{array}
Initial program 98.0%
associate-+l+98.0%
fma-define99.2%
+-commutative99.2%
fma-define99.6%
Simplified99.6%
(FPCore (x y z t a b) :precision binary64 (+ (fma x y (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, (z * t)) + (a * b);
}
function code(x, y, z, t, a, b) return Float64(fma(x, y, Float64(z * t)) + Float64(a * b)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b
\end{array}
Initial program 98.0%
fma-define99.2%
Simplified99.2%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -2e+70) (* a b) (if (<= (* a b) -4e-71) (* z t) (if (<= (* a b) 5e+40) (* x y) (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2e+70) {
tmp = a * b;
} else if ((a * b) <= -4e-71) {
tmp = z * t;
} else if ((a * b) <= 5e+40) {
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+70)) then
tmp = a * b
else if ((a * b) <= (-4d-71)) then
tmp = z * t
else if ((a * b) <= 5d+40) 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+70) {
tmp = a * b;
} else if ((a * b) <= -4e-71) {
tmp = z * t;
} else if ((a * b) <= 5e+40) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -2e+70: tmp = a * b elif (a * b) <= -4e-71: tmp = z * t elif (a * b) <= 5e+40: 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+70) tmp = Float64(a * b); elseif (Float64(a * b) <= -4e-71) tmp = Float64(z * t); elseif (Float64(a * b) <= 5e+40) 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+70) tmp = a * b; elseif ((a * b) <= -4e-71) tmp = z * t; elseif ((a * b) <= 5e+40) 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+70], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -4e-71], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+40], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+70}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{-71}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+40}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000015e70 or 5.00000000000000003e40 < (*.f64 a b) Initial program 95.9%
fma-define97.9%
Simplified97.9%
Taylor expanded in a around inf 74.5%
if -2.00000000000000015e70 < (*.f64 a b) < -3.9999999999999997e-71Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 94.5%
+-commutative94.5%
associate-/l*94.5%
associate-/l*88.6%
Simplified88.6%
Taylor expanded in x around 0 69.2%
associate-*r/63.3%
Simplified63.3%
Taylor expanded in t around inf 51.0%
if -3.9999999999999997e-71 < (*.f64 a b) < 5.00000000000000003e40Initial program 99.1%
Taylor expanded in x around inf 60.0%
Taylor expanded in x around inf 59.9%
Taylor expanded in y around inf 53.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -5e+42) (not (<= (* x y) 2e+51))) (* x (+ y (/ (* z t) x))) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -5e+42) || !((x * y) <= 2e+51)) {
tmp = x * (y + ((z * t) / x));
} 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) <= (-5d+42)) .or. (.not. ((x * y) <= 2d+51))) then
tmp = x * (y + ((z * t) / x))
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) <= -5e+42) || !((x * y) <= 2e+51)) {
tmp = x * (y + ((z * t) / x));
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -5e+42) or not ((x * y) <= 2e+51): tmp = x * (y + ((z * t) / x)) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(x * y) <= -5e+42) || !(Float64(x * y) <= 2e+51)) tmp = Float64(x * Float64(y + Float64(Float64(z * t) / x))); 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) <= -5e+42) || ~(((x * y) <= 2e+51))) tmp = x * (y + ((z * t) / x)); 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], -5e+42], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+51]], $MachinePrecision]], N[(x * N[(y + N[(N[(z * t), $MachinePrecision] / x), $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 -5 \cdot 10^{+42} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+51}\right):\\
\;\;\;\;x \cdot \left(y + \frac{z \cdot t}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000007e42 or 2e51 < (*.f64 x y) Initial program 95.2%
Taylor expanded in t around inf 81.8%
Taylor expanded in a around 0 72.6%
Taylor expanded in x around inf 85.2%
if -5.00000000000000007e42 < (*.f64 x y) < 2e51Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 88.0%
Final simplification86.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -2e+70) (not (<= (* a b) 2e-27))) (+ (* 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+70) || !((a * b) <= 2e-27)) {
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+70)) .or. (.not. ((a * b) <= 2d-27))) 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+70) || !((a * b) <= 2e-27)) {
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+70) or not ((a * b) <= 2e-27): 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+70) || !(Float64(a * b) <= 2e-27)) 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+70) || ~(((a * b) <= 2e-27))) 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+70], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e-27]], $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^{+70} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{-27}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000015e70 or 2.0000000000000001e-27 < (*.f64 a b) Initial program 95.7%
fma-define98.3%
Simplified98.3%
Taylor expanded in x around 0 83.5%
if -2.00000000000000015e70 < (*.f64 a b) < 2.0000000000000001e-27Initial program 99.9%
Taylor expanded in t around inf 91.8%
Taylor expanded in a around 0 81.6%
Taylor expanded in t around 0 89.7%
Final simplification86.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -1e+151) (not (<= (* x y) 1e+68))) (* 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) <= -1e+151) || !((x * y) <= 1e+68)) {
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) <= (-1d+151)) .or. (.not. ((x * y) <= 1d+68))) 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) <= -1e+151) || !((x * y) <= 1e+68)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -1e+151) or not ((x * y) <= 1e+68): 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) <= -1e+151) || !(Float64(x * y) <= 1e+68)) 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) <= -1e+151) || ~(((x * y) <= 1e+68))) 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], -1e+151], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+68]], $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 -1 \cdot 10^{+151} \lor \neg \left(x \cdot y \leq 10^{+68}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000002e151 or 9.99999999999999953e67 < (*.f64 x y) Initial program 95.0%
Taylor expanded in x around inf 84.7%
Taylor expanded in x around inf 86.0%
Taylor expanded in y around inf 76.5%
if -1.00000000000000002e151 < (*.f64 x y) < 9.99999999999999953e67Initial program 99.4%
fma-define99.4%
Simplified99.4%
Taylor expanded in x around 0 84.3%
Final simplification81.8%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -2e+70) (+ (* a b) (* z t)) (if (<= (* a b) 5e+19) (+ (* x y) (* z t)) (+ (* a b) (* x y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2e+70) {
tmp = (a * b) + (z * t);
} else if ((a * b) <= 5e+19) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (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 ((a * b) <= (-2d+70)) then
tmp = (a * b) + (z * t)
else if ((a * b) <= 5d+19) then
tmp = (x * y) + (z * t)
else
tmp = (a * b) + (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 ((a * b) <= -2e+70) {
tmp = (a * b) + (z * t);
} else if ((a * b) <= 5e+19) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -2e+70: tmp = (a * b) + (z * t) elif (a * b) <= 5e+19: tmp = (x * y) + (z * t) else: tmp = (a * b) + (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -2e+70) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (Float64(a * b) <= 5e+19) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(Float64(a * b) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a * b) <= -2e+70) tmp = (a * b) + (z * t); elseif ((a * b) <= 5e+19) tmp = (x * y) + (z * t); else tmp = (a * b) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e+70], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+19], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+70}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+19}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000015e70Initial program 99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 91.7%
if -2.00000000000000015e70 < (*.f64 a b) < 5e19Initial program 99.3%
Taylor expanded in t around inf 91.4%
Taylor expanded in a around 0 79.5%
Taylor expanded in t around 0 87.4%
if 5e19 < (*.f64 a b) Initial program 93.3%
Taylor expanded in x around inf 83.8%
Final simplification87.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -7.5e+60) (not (<= (* a b) 2.8e+43))) (* a b) (* x y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -7.5e+60) || !((a * b) <= 2.8e+43)) {
tmp = a * b;
} 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 (((a * b) <= (-7.5d+60)) .or. (.not. ((a * b) <= 2.8d+43))) then
tmp = a * b
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 (((a * b) <= -7.5e+60) || !((a * b) <= 2.8e+43)) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -7.5e+60) or not ((a * b) <= 2.8e+43): tmp = a * b else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -7.5e+60) || !(Float64(a * b) <= 2.8e+43)) tmp = Float64(a * b); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((a * b) <= -7.5e+60) || ~(((a * b) <= 2.8e+43))) tmp = a * b; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -7.5e+60], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.8e+43]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(x * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.5 \cdot 10^{+60} \lor \neg \left(a \cdot b \leq 2.8 \cdot 10^{+43}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -7.5e60 or 2.80000000000000019e43 < (*.f64 a b) Initial program 95.9%
fma-define97.9%
Simplified97.9%
Taylor expanded in a around inf 74.5%
if -7.5e60 < (*.f64 a b) < 2.80000000000000019e43Initial program 99.3%
Taylor expanded in x around inf 57.6%
Taylor expanded in x around inf 57.6%
Taylor expanded in y around inf 48.1%
Final simplification58.2%
(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 98.0%
fma-define99.2%
Simplified99.2%
Taylor expanded in a around inf 36.1%
herbie shell --seed 2024170
(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)))