
(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 z t (fma a b (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(z, t, fma(a, b, (x * y)));
}
function code(x, y, z, t, a, b) return fma(z, t, fma(a, b, Float64(x * y))) end
code[x_, y_, z_, t_, a_, b_] := N[(z * t + N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, t, \mathsf{fma}\left(a, b, x \cdot y\right)\right)
\end{array}
Initial program 97.6%
+-commutative97.6%
associate-+r+97.6%
+-commutative97.6%
fma-def99.6%
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 97.6%
fma-def98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a b) :precision binary64 (+ (* x y) (fma z t (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
return (x * y) + fma(z, t, (a * b));
}
function code(x, y, z, t, a, b) return Float64(Float64(x * y) + fma(z, t, Float64(a * b))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * y), $MachinePrecision] + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot y + \mathsf{fma}\left(z, t, a \cdot b\right)
\end{array}
Initial program 97.6%
+-commutative97.6%
associate-+r+97.6%
+-commutative97.6%
fma-def99.6%
fma-def99.6%
Simplified99.6%
fma-udef97.7%
fma-udef97.6%
associate-+r+97.6%
fma-def99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* a b) (+ (* x y) (* z t))))) (if (<= t_1 INFINITY) t_1 (+ (* x y) (* a b)))))
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 = (x * y) + (a * b);
}
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 = (x * y) + (a * b);
}
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 = (x * y) + (a * b) 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(Float64(x * y) + Float64(a * b)); 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 = (x * y) + (a * b); 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[(N[(x * y), $MachinePrecision] + N[(a * b), $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}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\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 z around 0 83.3%
Final simplification99.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -3e+84)
(* a b)
(if (<= (* a b) -3.6e-29)
(* z t)
(if (<= (* a b) -3.5e-124)
(* x y)
(if (<= (* a b) 1.55e+111) (* z t) (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -3e+84) {
tmp = a * b;
} else if ((a * b) <= -3.6e-29) {
tmp = z * t;
} else if ((a * b) <= -3.5e-124) {
tmp = x * y;
} else if ((a * b) <= 1.55e+111) {
tmp = z * t;
} 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) <= (-3d+84)) then
tmp = a * b
else if ((a * b) <= (-3.6d-29)) then
tmp = z * t
else if ((a * b) <= (-3.5d-124)) then
tmp = x * y
else if ((a * b) <= 1.55d+111) then
tmp = z * t
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) <= -3e+84) {
tmp = a * b;
} else if ((a * b) <= -3.6e-29) {
tmp = z * t;
} else if ((a * b) <= -3.5e-124) {
tmp = x * y;
} else if ((a * b) <= 1.55e+111) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -3e+84: tmp = a * b elif (a * b) <= -3.6e-29: tmp = z * t elif (a * b) <= -3.5e-124: tmp = x * y elif (a * b) <= 1.55e+111: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -3e+84) tmp = Float64(a * b); elseif (Float64(a * b) <= -3.6e-29) tmp = Float64(z * t); elseif (Float64(a * b) <= -3.5e-124) tmp = Float64(x * y); elseif (Float64(a * b) <= 1.55e+111) tmp = Float64(z * t); 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) <= -3e+84) tmp = a * b; elseif ((a * b) <= -3.6e-29) tmp = z * t; elseif ((a * b) <= -3.5e-124) tmp = x * y; elseif ((a * b) <= 1.55e+111) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -3e+84], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -3.6e-29], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -3.5e-124], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.55e+111], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3 \cdot 10^{+84}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -3.6 \cdot 10^{-29}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -3.5 \cdot 10^{-124}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{+111}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -2.99999999999999996e84 or 1.55e111 < (*.f64 a b) Initial program 95.5%
Taylor expanded in a around inf 71.9%
if -2.99999999999999996e84 < (*.f64 a b) < -3.59999999999999974e-29 or -3.4999999999999999e-124 < (*.f64 a b) < 1.55e111Initial program 98.6%
Taylor expanded in z around inf 57.6%
if -3.59999999999999974e-29 < (*.f64 a b) < -3.4999999999999999e-124Initial program 100.0%
Taylor expanded in x around inf 73.0%
Final simplification64.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -2.8e+133) (not (<= (* x y) 2.7e+43))) (+ (* 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) <= -2.8e+133) || !((x * y) <= 2.7e+43)) {
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) <= (-2.8d+133)) .or. (.not. ((x * y) <= 2.7d+43))) 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) <= -2.8e+133) || !((x * y) <= 2.7e+43)) {
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) <= -2.8e+133) or not ((x * y) <= 2.7e+43): 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) <= -2.8e+133) || !(Float64(x * y) <= 2.7e+43)) 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) <= -2.8e+133) || ~(((x * y) <= 2.7e+43))) 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], -2.8e+133], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.7e+43]], $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 -2.8 \cdot 10^{+133} \lor \neg \left(x \cdot y \leq 2.7 \cdot 10^{+43}\right):\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -2.80000000000000016e133 or 2.7000000000000002e43 < (*.f64 x y) Initial program 95.8%
Taylor expanded in z around 0 83.5%
if -2.80000000000000016e133 < (*.f64 x y) < 2.7000000000000002e43Initial program 98.7%
Taylor expanded in x around 0 89.7%
Final simplification87.4%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -1.25e+134) (* x y) (if (<= (* x y) 1.55e+113) (+ (* a b) (* z t)) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -1.25e+134) {
tmp = x * y;
} else if ((x * y) <= 1.55e+113) {
tmp = (a * b) + (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) <= (-1.25d+134)) then
tmp = x * y
else if ((x * y) <= 1.55d+113) then
tmp = (a * b) + (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) <= -1.25e+134) {
tmp = x * y;
} else if ((x * y) <= 1.55e+113) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -1.25e+134: tmp = x * y elif (x * y) <= 1.55e+113: tmp = (a * b) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -1.25e+134) tmp = Float64(x * y); elseif (Float64(x * y) <= 1.55e+113) tmp = Float64(Float64(a * b) + 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) <= -1.25e+134) tmp = x * y; elseif ((x * y) <= 1.55e+113) tmp = (a * b) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -1.25e+134], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.55e+113], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.25 \cdot 10^{+134}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 1.55 \cdot 10^{+113}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -1.24999999999999995e134 or 1.54999999999999996e113 < (*.f64 x y) Initial program 96.3%
Taylor expanded in x around inf 75.6%
if -1.24999999999999995e134 < (*.f64 x y) < 1.54999999999999996e113Initial program 98.3%
Taylor expanded in x around 0 87.2%
Final simplification83.5%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -1.36e+53) (+ (* a b) (* z t)) (if (<= (* a b) 4.5e+134) (+ (* x y) (* z t)) (+ (* x y) (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -1.36e+53) {
tmp = (a * b) + (z * t);
} else if ((a * b) <= 4.5e+134) {
tmp = (x * y) + (z * t);
} else {
tmp = (x * y) + (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) <= (-1.36d+53)) then
tmp = (a * b) + (z * t)
else if ((a * b) <= 4.5d+134) then
tmp = (x * y) + (z * t)
else
tmp = (x * y) + (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) <= -1.36e+53) {
tmp = (a * b) + (z * t);
} else if ((a * b) <= 4.5e+134) {
tmp = (x * y) + (z * t);
} else {
tmp = (x * y) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -1.36e+53: tmp = (a * b) + (z * t) elif (a * b) <= 4.5e+134: tmp = (x * y) + (z * t) else: tmp = (x * y) + (a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -1.36e+53) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (Float64(a * b) <= 4.5e+134) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(Float64(x * y) + Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a * b) <= -1.36e+53) tmp = (a * b) + (z * t); elseif ((a * b) <= 4.5e+134) tmp = (x * y) + (z * t); else tmp = (x * y) + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.36e+53], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4.5e+134], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.36 \cdot 10^{+53}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 4.5 \cdot 10^{+134}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.36e53Initial program 97.8%
Taylor expanded in x around 0 84.9%
if -1.36e53 < (*.f64 a b) < 4.4999999999999997e134Initial program 98.8%
Taylor expanded in a around 0 88.9%
if 4.4999999999999997e134 < (*.f64 a b) Initial program 93.0%
Taylor expanded in z around 0 92.0%
Final simplification88.7%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -4.3e+83) (* a b) (if (<= (* a b) 9e+110) (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -4.3e+83) {
tmp = a * b;
} else if ((a * b) <= 9e+110) {
tmp = z * t;
} 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) <= (-4.3d+83)) then
tmp = a * b
else if ((a * b) <= 9d+110) then
tmp = z * t
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) <= -4.3e+83) {
tmp = a * b;
} else if ((a * b) <= 9e+110) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -4.3e+83: tmp = a * b elif (a * b) <= 9e+110: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -4.3e+83) tmp = Float64(a * b); elseif (Float64(a * b) <= 9e+110) tmp = Float64(z * t); 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) <= -4.3e+83) tmp = a * b; elseif ((a * b) <= 9e+110) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -4.3e+83], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 9e+110], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.3 \cdot 10^{+83}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 9 \cdot 10^{+110}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -4.3e83 or 9.0000000000000005e110 < (*.f64 a b) Initial program 95.5%
Taylor expanded in a around inf 71.9%
if -4.3e83 < (*.f64 a b) < 9.0000000000000005e110Initial program 98.8%
Taylor expanded in z around inf 52.4%
Final simplification59.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 97.6%
Taylor expanded in a around inf 33.4%
Final simplification33.4%
herbie shell --seed 2023297
(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)))