
(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 (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.4%
associate-+l+98.4%
fma-def99.2%
+-commutative99.2%
fma-def99.6%
Simplified99.6%
Final simplification99.6%
(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.4%
fma-def98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a b) :precision binary64 (+ (fma z t (* x y)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(z, t, (x * y)) + (a * b);
}
function code(x, y, z, t, a, b) return Float64(fma(z, t, Float64(x * y)) + Float64(a * b)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(z * t + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, t, x \cdot y\right) + a \cdot b
\end{array}
Initial program 98.4%
+-commutative98.4%
fma-def98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -1.15e+48)
(* x y)
(if (<= (* x y) -1e-305)
(* z t)
(if (<= (* x y) 5.5e-223)
(* a b)
(if (<= (* x y) 1.5e-41)
(* z t)
(if (<= (* x y) 3.1e+64) (* a b) (* x y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -1.15e+48) {
tmp = x * y;
} else if ((x * y) <= -1e-305) {
tmp = z * t;
} else if ((x * y) <= 5.5e-223) {
tmp = a * b;
} else if ((x * y) <= 1.5e-41) {
tmp = z * t;
} else if ((x * y) <= 3.1e+64) {
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 ((x * y) <= (-1.15d+48)) then
tmp = x * y
else if ((x * y) <= (-1d-305)) then
tmp = z * t
else if ((x * y) <= 5.5d-223) then
tmp = a * b
else if ((x * y) <= 1.5d-41) then
tmp = z * t
else if ((x * y) <= 3.1d+64) 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 ((x * y) <= -1.15e+48) {
tmp = x * y;
} else if ((x * y) <= -1e-305) {
tmp = z * t;
} else if ((x * y) <= 5.5e-223) {
tmp = a * b;
} else if ((x * y) <= 1.5e-41) {
tmp = z * t;
} else if ((x * y) <= 3.1e+64) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -1.15e+48: tmp = x * y elif (x * y) <= -1e-305: tmp = z * t elif (x * y) <= 5.5e-223: tmp = a * b elif (x * y) <= 1.5e-41: tmp = z * t elif (x * y) <= 3.1e+64: tmp = a * b else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -1.15e+48) tmp = Float64(x * y); elseif (Float64(x * y) <= -1e-305) tmp = Float64(z * t); elseif (Float64(x * y) <= 5.5e-223) tmp = Float64(a * b); elseif (Float64(x * y) <= 1.5e-41) tmp = Float64(z * t); elseif (Float64(x * y) <= 3.1e+64) 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 ((x * y) <= -1.15e+48) tmp = x * y; elseif ((x * y) <= -1e-305) tmp = z * t; elseif ((x * y) <= 5.5e-223) tmp = a * b; elseif ((x * y) <= 1.5e-41) tmp = z * t; elseif ((x * y) <= 3.1e+64) tmp = a * b; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -1.15e+48], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1e-305], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5.5e-223], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.5e-41], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.1e+64], N[(a * b), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.15 \cdot 10^{+48}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-305}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 5.5 \cdot 10^{-223}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 1.5 \cdot 10^{-41}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 3.1 \cdot 10^{+64}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -1.15e48 or 3.0999999999999999e64 < (*.f64 x y) Initial program 97.0%
+-commutative97.0%
fma-def98.0%
Applied egg-rr98.0%
Taylor expanded in x around inf 72.2%
if -1.15e48 < (*.f64 x y) < -9.99999999999999996e-306 or 5.5e-223 < (*.f64 x y) < 1.49999999999999994e-41Initial program 99.0%
+-commutative99.0%
fma-def99.0%
Applied egg-rr99.0%
Taylor expanded in z around inf 59.1%
if -9.99999999999999996e-306 < (*.f64 x y) < 5.5e-223 or 1.49999999999999994e-41 < (*.f64 x y) < 3.0999999999999999e64Initial program 100.0%
Taylor expanded in a around inf 59.9%
Final simplification64.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* x y) (* a b))))
(if (<= (* x y) -2e+207)
t_1
(if (<= (* x y) -9.6e-52)
(+ (* x y) (* z t))
(if (<= (* x y) 1.75e-44) (+ (* a b) (* z t)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (a * b);
double tmp;
if ((x * y) <= -2e+207) {
tmp = t_1;
} else if ((x * y) <= -9.6e-52) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 1.75e-44) {
tmp = (a * b) + (z * t);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = (x * y) + (a * b)
if ((x * y) <= (-2d+207)) then
tmp = t_1
else if ((x * y) <= (-9.6d-52)) then
tmp = (x * y) + (z * t)
else if ((x * y) <= 1.75d-44) then
tmp = (a * b) + (z * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (a * b);
double tmp;
if ((x * y) <= -2e+207) {
tmp = t_1;
} else if ((x * y) <= -9.6e-52) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 1.75e-44) {
tmp = (a * b) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * y) + (a * b) tmp = 0 if (x * y) <= -2e+207: tmp = t_1 elif (x * y) <= -9.6e-52: tmp = (x * y) + (z * t) elif (x * y) <= 1.75e-44: tmp = (a * b) + (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * y) + Float64(a * b)) tmp = 0.0 if (Float64(x * y) <= -2e+207) tmp = t_1; elseif (Float64(x * y) <= -9.6e-52) tmp = Float64(Float64(x * y) + Float64(z * t)); elseif (Float64(x * y) <= 1.75e-44) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * y) + (a * b); tmp = 0.0; if ((x * y) <= -2e+207) tmp = t_1; elseif ((x * y) <= -9.6e-52) tmp = (x * y) + (z * t); elseif ((x * y) <= 1.75e-44) tmp = (a * b) + (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+207], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -9.6e-52], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.75e-44], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + a \cdot b\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+207}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq -9.6 \cdot 10^{-52}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 1.75 \cdot 10^{-44}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e207 or 1.7499999999999999e-44 < (*.f64 x y) Initial program 96.8%
Taylor expanded in x around inf 91.6%
if -2.0000000000000001e207 < (*.f64 x y) < -9.6000000000000007e-52Initial program 97.9%
+-commutative97.9%
fma-def97.9%
Applied egg-rr97.9%
Taylor expanded in a around 0 85.8%
if -9.6000000000000007e-52 < (*.f64 x y) < 1.7499999999999999e-44Initial program 100.0%
Taylor expanded in x around 0 97.8%
Final simplification93.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -2.9e+98) (not (<= (* x y) 1.35e+115))) (* 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) <= -2.9e+98) || !((x * y) <= 1.35e+115)) {
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) <= (-2.9d+98)) .or. (.not. ((x * y) <= 1.35d+115))) 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) <= -2.9e+98) || !((x * y) <= 1.35e+115)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -2.9e+98) or not ((x * y) <= 1.35e+115): 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) <= -2.9e+98) || !(Float64(x * y) <= 1.35e+115)) 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) <= -2.9e+98) || ~(((x * y) <= 1.35e+115))) 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], -2.9e+98], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.35e+115]], $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 -2.9 \cdot 10^{+98} \lor \neg \left(x \cdot y \leq 1.35 \cdot 10^{+115}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -2.9000000000000001e98 or 1.35000000000000002e115 < (*.f64 x y) Initial program 96.4%
+-commutative96.4%
fma-def97.6%
Applied egg-rr97.6%
Taylor expanded in x around inf 77.8%
if -2.9000000000000001e98 < (*.f64 x y) < 1.35000000000000002e115Initial program 99.4%
Taylor expanded in x around 0 84.8%
Final simplification82.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -2e-50) (not (<= (* x y) 3.9e+62))) (+ (* 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 (((x * y) <= -2e-50) || !((x * y) <= 3.9e+62)) {
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 (((x * y) <= (-2d-50)) .or. (.not. ((x * y) <= 3.9d+62))) 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 (((x * y) <= -2e-50) || !((x * y) <= 3.9e+62)) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -2e-50) or not ((x * y) <= 3.9e+62): 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(x * y) <= -2e-50) || !(Float64(x * y) <= 3.9e+62)) 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 (((x * y) <= -2e-50) || ~(((x * y) <= 3.9e+62))) tmp = (x * y) + (z * t); 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], -2e-50], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3.9e+62]], $MachinePrecision]], 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}\;x \cdot y \leq -2 \cdot 10^{-50} \lor \neg \left(x \cdot y \leq 3.9 \cdot 10^{+62}\right):\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000002e-50 or 3.9e62 < (*.f64 x y) Initial program 96.7%
+-commutative96.7%
fma-def97.6%
Applied egg-rr97.6%
Taylor expanded in a around 0 82.0%
if -2.00000000000000002e-50 < (*.f64 x y) < 3.9e62Initial program 100.0%
Taylor expanded in x around 0 93.1%
Final simplification87.7%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (+ (* x y) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((x * y) + (z * t));
}
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) + ((x * y) + (z * t))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((x * y) + (z * t));
}
def code(x, y, z, t, a, b): return (a * b) + ((x * y) + (z * t))
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) end
function tmp = code(x, y, z, t, a, b) tmp = (a * b) + ((x * y) + (z * t)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \left(x \cdot y + z \cdot t\right)
\end{array}
Initial program 98.4%
Final simplification98.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1e+96) (not (<= a 1.8e-115))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1e+96) || !(a <= 1.8e-115)) {
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 <= (-1d+96)) .or. (.not. (a <= 1.8d-115))) 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 <= -1e+96) || !(a <= 1.8e-115)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1e+96) or not (a <= 1.8e-115): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1e+96) || !(a <= 1.8e-115)) 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 <= -1e+96) || ~((a <= 1.8e-115))) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1e+96], N[Not[LessEqual[a, 1.8e-115]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+96} \lor \neg \left(a \leq 1.8 \cdot 10^{-115}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if a < -1.00000000000000005e96 or 1.80000000000000005e-115 < a Initial program 97.6%
Taylor expanded in a around inf 46.6%
if -1.00000000000000005e96 < a < 1.80000000000000005e-115Initial program 99.2%
+-commutative99.2%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 47.2%
Final simplification46.9%
(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.4%
Taylor expanded in a around inf 31.4%
Final simplification31.4%
herbie shell --seed 2023332
(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)))