
(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 (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 98.8%
associate-+l+98.8%
fma-define98.8%
fma-define99.2%
Simplified99.2%
(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.8%
associate-+l+98.8%
fma-define98.8%
+-commutative98.8%
fma-define98.8%
Simplified98.8%
(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 98.8%
fma-define98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* z t) -5.2e+97)
(* z t)
(if (<= (* z t) -2400000000.0)
(* x y)
(if (<= (* z t) -2e-313)
(* a b)
(if (<= (* z t) 1e-67)
(* x y)
(if (<= (* z t) 1.06e+167) (* a b) (* z t)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z * t) <= -5.2e+97) {
tmp = z * t;
} else if ((z * t) <= -2400000000.0) {
tmp = x * y;
} else if ((z * t) <= -2e-313) {
tmp = a * b;
} else if ((z * t) <= 1e-67) {
tmp = x * y;
} else if ((z * t) <= 1.06e+167) {
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 ((z * t) <= (-5.2d+97)) then
tmp = z * t
else if ((z * t) <= (-2400000000.0d0)) then
tmp = x * y
else if ((z * t) <= (-2d-313)) then
tmp = a * b
else if ((z * t) <= 1d-67) then
tmp = x * y
else if ((z * t) <= 1.06d+167) 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 ((z * t) <= -5.2e+97) {
tmp = z * t;
} else if ((z * t) <= -2400000000.0) {
tmp = x * y;
} else if ((z * t) <= -2e-313) {
tmp = a * b;
} else if ((z * t) <= 1e-67) {
tmp = x * y;
} else if ((z * t) <= 1.06e+167) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z * t) <= -5.2e+97: tmp = z * t elif (z * t) <= -2400000000.0: tmp = x * y elif (z * t) <= -2e-313: tmp = a * b elif (z * t) <= 1e-67: tmp = x * y elif (z * t) <= 1.06e+167: tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(z * t) <= -5.2e+97) tmp = Float64(z * t); elseif (Float64(z * t) <= -2400000000.0) tmp = Float64(x * y); elseif (Float64(z * t) <= -2e-313) tmp = Float64(a * b); elseif (Float64(z * t) <= 1e-67) tmp = Float64(x * y); elseif (Float64(z * t) <= 1.06e+167) 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 ((z * t) <= -5.2e+97) tmp = z * t; elseif ((z * t) <= -2400000000.0) tmp = x * y; elseif ((z * t) <= -2e-313) tmp = a * b; elseif ((z * t) <= 1e-67) tmp = x * y; elseif ((z * t) <= 1.06e+167) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(z * t), $MachinePrecision], -5.2e+97], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -2400000000.0], N[(x * y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -2e-313], N[(a * b), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e-67], N[(x * y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1.06e+167], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5.2 \cdot 10^{+97}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq -2400000000:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-313}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;z \cdot t \leq 10^{-67}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \cdot t \leq 1.06 \cdot 10^{+167}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -5.2e97 or 1.06e167 < (*.f64 z t) Initial program 97.6%
fma-define97.6%
Simplified97.6%
Taylor expanded in x around 0 89.6%
Taylor expanded in z around inf 89.7%
Taylor expanded in t around inf 80.2%
if -5.2e97 < (*.f64 z t) < -2.4e9 or -1.99999999998e-313 < (*.f64 z t) < 9.99999999999999943e-68Initial program 98.8%
Taylor expanded in x around inf 94.4%
Taylor expanded in y around inf 91.1%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in x around inf 63.6%
if -2.4e9 < (*.f64 z t) < -1.99999999998e-313 or 9.99999999999999943e-68 < (*.f64 z t) < 1.06e167Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in a around inf 55.9%
Final simplification66.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -4.1e+41) (not (<= (* a b) 6400000.0))) (+ (* a b) (* z t)) (+ (* z t) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -4.1e+41) || !((a * b) <= 6400000.0)) {
tmp = (a * b) + (z * t);
} else {
tmp = (z * t) + (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) <= (-4.1d+41)) .or. (.not. ((a * b) <= 6400000.0d0))) then
tmp = (a * b) + (z * t)
else
tmp = (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 tmp;
if (((a * b) <= -4.1e+41) || !((a * b) <= 6400000.0)) {
tmp = (a * b) + (z * t);
} else {
tmp = (z * t) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -4.1e+41) or not ((a * b) <= 6400000.0): tmp = (a * b) + (z * t) else: tmp = (z * t) + (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -4.1e+41) || !(Float64(a * b) <= 6400000.0)) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(Float64(z * t) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((a * b) <= -4.1e+41) || ~(((a * b) <= 6400000.0))) tmp = (a * b) + (z * t); else tmp = (z * t) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -4.1e+41], N[Not[LessEqual[N[(a * b), $MachinePrecision], 6400000.0]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.1 \cdot 10^{+41} \lor \neg \left(a \cdot b \leq 6400000\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -4.1000000000000004e41 or 6.4e6 < (*.f64 a b) Initial program 97.5%
fma-define97.5%
Simplified97.5%
Taylor expanded in x around 0 85.9%
if -4.1000000000000004e41 < (*.f64 a b) < 6.4e6Initial program 100.0%
Taylor expanded in x around inf 88.2%
Taylor expanded in a around 0 81.7%
Taylor expanded in x around 0 93.5%
Final simplification89.8%
(FPCore (x y z t a b) :precision binary64 (if (<= (* z t) -5e+98) (* z (+ t (/ (* a b) z))) (if (<= (* z t) 2e+107) (+ (* a b) (* x y)) (+ (* z t) (* x y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z * t) <= -5e+98) {
tmp = z * (t + ((a * b) / z));
} else if ((z * t) <= 2e+107) {
tmp = (a * b) + (x * y);
} else {
tmp = (z * t) + (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 ((z * t) <= (-5d+98)) then
tmp = z * (t + ((a * b) / z))
else if ((z * t) <= 2d+107) then
tmp = (a * b) + (x * y)
else
tmp = (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 tmp;
if ((z * t) <= -5e+98) {
tmp = z * (t + ((a * b) / z));
} else if ((z * t) <= 2e+107) {
tmp = (a * b) + (x * y);
} else {
tmp = (z * t) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z * t) <= -5e+98: tmp = z * (t + ((a * b) / z)) elif (z * t) <= 2e+107: tmp = (a * b) + (x * y) else: tmp = (z * t) + (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(z * t) <= -5e+98) tmp = Float64(z * Float64(t + Float64(Float64(a * b) / z))); elseif (Float64(z * t) <= 2e+107) tmp = Float64(Float64(a * b) + Float64(x * y)); else tmp = Float64(Float64(z * t) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z * t) <= -5e+98) tmp = z * (t + ((a * b) / z)); elseif ((z * t) <= 2e+107) tmp = (a * b) + (x * y); else tmp = (z * t) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+98], N[(z * N[(t + N[(N[(a * b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+107], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+98}:\\
\;\;\;\;z \cdot \left(t + \frac{a \cdot b}{z}\right)\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+107}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\end{array}
\end{array}
if (*.f64 z t) < -4.9999999999999998e98Initial program 97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in x around 0 88.7%
Taylor expanded in z around inf 88.9%
if -4.9999999999999998e98 < (*.f64 z t) < 1.9999999999999999e107Initial program 99.4%
Taylor expanded in x around inf 89.2%
if 1.9999999999999999e107 < (*.f64 z t) Initial program 97.8%
Taylor expanded in x around inf 71.9%
Taylor expanded in a around 0 69.8%
Taylor expanded in x around 0 93.7%
Final simplification89.9%
(FPCore (x y z t a b) :precision binary64 (if (<= (* z t) -5e+98) (+ (* a b) (* z t)) (if (<= (* z t) 2e+107) (+ (* a b) (* x y)) (+ (* z t) (* x y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z * t) <= -5e+98) {
tmp = (a * b) + (z * t);
} else if ((z * t) <= 2e+107) {
tmp = (a * b) + (x * y);
} else {
tmp = (z * t) + (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 ((z * t) <= (-5d+98)) then
tmp = (a * b) + (z * t)
else if ((z * t) <= 2d+107) then
tmp = (a * b) + (x * y)
else
tmp = (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 tmp;
if ((z * t) <= -5e+98) {
tmp = (a * b) + (z * t);
} else if ((z * t) <= 2e+107) {
tmp = (a * b) + (x * y);
} else {
tmp = (z * t) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z * t) <= -5e+98: tmp = (a * b) + (z * t) elif (z * t) <= 2e+107: tmp = (a * b) + (x * y) else: tmp = (z * t) + (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(z * t) <= -5e+98) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (Float64(z * t) <= 2e+107) tmp = Float64(Float64(a * b) + Float64(x * y)); else tmp = Float64(Float64(z * t) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z * t) <= -5e+98) tmp = (a * b) + (z * t); elseif ((z * t) <= 2e+107) tmp = (a * b) + (x * y); else tmp = (z * t) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+98], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+107], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+98}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+107}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\end{array}
\end{array}
if (*.f64 z t) < -4.9999999999999998e98Initial program 97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in x around 0 88.7%
if -4.9999999999999998e98 < (*.f64 z t) < 1.9999999999999999e107Initial program 99.4%
Taylor expanded in x around inf 89.2%
if 1.9999999999999999e107 < (*.f64 z t) Initial program 97.8%
Taylor expanded in x around inf 71.9%
Taylor expanded in a around 0 69.8%
Taylor expanded in x around 0 93.7%
Final simplification89.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.1e-19) (not (<= y 2.55e+104))) (* x y) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3.1e-19) || !(y <= 2.55e+104)) {
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 ((y <= (-3.1d-19)) .or. (.not. (y <= 2.55d+104))) 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 ((y <= -3.1e-19) || !(y <= 2.55e+104)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -3.1e-19) or not (y <= 2.55e+104): tmp = x * y else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -3.1e-19) || !(y <= 2.55e+104)) 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 ((y <= -3.1e-19) || ~((y <= 2.55e+104))) tmp = x * y; else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -3.1e-19], N[Not[LessEqual[y, 2.55e+104]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-19} \lor \neg \left(y \leq 2.55 \cdot 10^{+104}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if y < -3.0999999999999999e-19 or 2.5500000000000001e104 < y Initial program 97.3%
Taylor expanded in x around inf 74.6%
Taylor expanded in y around inf 74.6%
associate-/l*75.3%
Simplified75.3%
Taylor expanded in x around inf 52.7%
if -3.0999999999999999e-19 < y < 2.5500000000000001e104Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 80.1%
Final simplification68.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -6.7e+46) (not (<= (* a b) 400000000000.0))) (* a b) (* x y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -6.7e+46) || !((a * b) <= 400000000000.0)) {
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) <= (-6.7d+46)) .or. (.not. ((a * b) <= 400000000000.0d0))) 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) <= -6.7e+46) || !((a * b) <= 400000000000.0)) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -6.7e+46) or not ((a * b) <= 400000000000.0): tmp = a * b else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -6.7e+46) || !(Float64(a * b) <= 400000000000.0)) 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) <= -6.7e+46) || ~(((a * b) <= 400000000000.0))) 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], -6.7e+46], N[Not[LessEqual[N[(a * b), $MachinePrecision], 400000000000.0]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(x * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.7 \cdot 10^{+46} \lor \neg \left(a \cdot b \leq 400000000000\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -6.7000000000000001e46 or 4e11 < (*.f64 a b) Initial program 97.5%
fma-define97.5%
Simplified97.5%
Taylor expanded in a around inf 64.8%
if -6.7000000000000001e46 < (*.f64 a b) < 4e11Initial program 100.0%
Taylor expanded in x around inf 59.8%
Taylor expanded in y around inf 59.8%
associate-/l*59.8%
Simplified59.8%
Taylor expanded in x around inf 53.5%
Final simplification58.9%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (+ (* z t) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((z * t) + (x * y));
}
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) + ((z * t) + (x * y))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((z * t) + (x * y));
}
def code(x, y, z, t, a, b): return (a * b) + ((z * t) + (x * y))
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) end
function tmp = code(x, y, z, t, a, b) tmp = (a * b) + ((z * t) + (x * y)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \left(z \cdot t + x \cdot y\right)
\end{array}
Initial program 98.8%
Final simplification98.8%
(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.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in a around inf 35.9%
herbie shell --seed 2024172
(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)))