
(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 8 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 (/ (* z t) 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 + ((z * t) / 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 + ((z * t) / 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 + ((z * t) / 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(z * t) / 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 + ((z * t) / 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[(z * t), $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{z \cdot t}{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 a around inf 60.0%
Taylor expanded in x around 0 80.0%
Final simplification99.6%
(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 98.0%
+-commutative98.0%
associate-+l+98.0%
fma-define98.4%
+-commutative98.4%
fma-define98.8%
Simplified98.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -8.5e+187)
(* a b)
(if (<= (* a b) -1.9e-54)
(* z t)
(if (<= (* a b) -7.2e-236)
(* x y)
(if (<= (* a b) 1.55e-271)
(* z t)
(if (<= (* a b) 3.7e-81)
(* x y)
(if (<= (* a b) 3.5e+32) (* z t) (* a b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -8.5e+187) {
tmp = a * b;
} else if ((a * b) <= -1.9e-54) {
tmp = z * t;
} else if ((a * b) <= -7.2e-236) {
tmp = x * y;
} else if ((a * b) <= 1.55e-271) {
tmp = z * t;
} else if ((a * b) <= 3.7e-81) {
tmp = x * y;
} else if ((a * b) <= 3.5e+32) {
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) <= (-8.5d+187)) then
tmp = a * b
else if ((a * b) <= (-1.9d-54)) then
tmp = z * t
else if ((a * b) <= (-7.2d-236)) then
tmp = x * y
else if ((a * b) <= 1.55d-271) then
tmp = z * t
else if ((a * b) <= 3.7d-81) then
tmp = x * y
else if ((a * b) <= 3.5d+32) 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) <= -8.5e+187) {
tmp = a * b;
} else if ((a * b) <= -1.9e-54) {
tmp = z * t;
} else if ((a * b) <= -7.2e-236) {
tmp = x * y;
} else if ((a * b) <= 1.55e-271) {
tmp = z * t;
} else if ((a * b) <= 3.7e-81) {
tmp = x * y;
} else if ((a * b) <= 3.5e+32) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -8.5e+187: tmp = a * b elif (a * b) <= -1.9e-54: tmp = z * t elif (a * b) <= -7.2e-236: tmp = x * y elif (a * b) <= 1.55e-271: tmp = z * t elif (a * b) <= 3.7e-81: tmp = x * y elif (a * b) <= 3.5e+32: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -8.5e+187) tmp = Float64(a * b); elseif (Float64(a * b) <= -1.9e-54) tmp = Float64(z * t); elseif (Float64(a * b) <= -7.2e-236) tmp = Float64(x * y); elseif (Float64(a * b) <= 1.55e-271) tmp = Float64(z * t); elseif (Float64(a * b) <= 3.7e-81) tmp = Float64(x * y); elseif (Float64(a * b) <= 3.5e+32) 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) <= -8.5e+187) tmp = a * b; elseif ((a * b) <= -1.9e-54) tmp = z * t; elseif ((a * b) <= -7.2e-236) tmp = x * y; elseif ((a * b) <= 1.55e-271) tmp = z * t; elseif ((a * b) <= 3.7e-81) tmp = x * y; elseif ((a * b) <= 3.5e+32) 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], -8.5e+187], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.9e-54], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -7.2e-236], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.55e-271], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.7e-81], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.5e+32], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.5 \cdot 10^{+187}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.9 \cdot 10^{-54}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -7.2 \cdot 10^{-236}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{-271}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 3.7 \cdot 10^{-81}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 3.5 \cdot 10^{+32}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -8.49999999999999989e187 or 3.5000000000000001e32 < (*.f64 a b) Initial program 95.5%
Taylor expanded in a around inf 75.9%
if -8.49999999999999989e187 < (*.f64 a b) < -1.9000000000000001e-54 or -7.20000000000000015e-236 < (*.f64 a b) < 1.54999999999999995e-271 or 3.69999999999999986e-81 < (*.f64 a b) < 3.5000000000000001e32Initial program 99.9%
Taylor expanded in z around inf 54.6%
if -1.9000000000000001e-54 < (*.f64 a b) < -7.20000000000000015e-236 or 1.54999999999999995e-271 < (*.f64 a b) < 3.69999999999999986e-81Initial program 98.0%
Taylor expanded in x around inf 60.7%
Final simplification63.1%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= (* x y) -5.1e+230)
(and (not (<= (* x y) -1.85e+92))
(or (<= (* x y) -6e+73) (not (<= (* x y) 2.8e+233)))))
(* 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) <= -5.1e+230) || (!((x * y) <= -1.85e+92) && (((x * y) <= -6e+73) || !((x * y) <= 2.8e+233)))) {
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) <= (-5.1d+230)) .or. (.not. ((x * y) <= (-1.85d+92))) .and. ((x * y) <= (-6d+73)) .or. (.not. ((x * y) <= 2.8d+233))) 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) <= -5.1e+230) || (!((x * y) <= -1.85e+92) && (((x * y) <= -6e+73) || !((x * y) <= 2.8e+233)))) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -5.1e+230) or (not ((x * y) <= -1.85e+92) and (((x * y) <= -6e+73) or not ((x * y) <= 2.8e+233))): 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) <= -5.1e+230) || (!(Float64(x * y) <= -1.85e+92) && ((Float64(x * y) <= -6e+73) || !(Float64(x * y) <= 2.8e+233)))) 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) <= -5.1e+230) || (~(((x * y) <= -1.85e+92)) && (((x * y) <= -6e+73) || ~(((x * y) <= 2.8e+233))))) 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], -5.1e+230], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], -1.85e+92]], $MachinePrecision], Or[LessEqual[N[(x * y), $MachinePrecision], -6e+73], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.8e+233]], $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 -5.1 \cdot 10^{+230} \lor \neg \left(x \cdot y \leq -1.85 \cdot 10^{+92}\right) \land \left(x \cdot y \leq -6 \cdot 10^{+73} \lor \neg \left(x \cdot y \leq 2.8 \cdot 10^{+233}\right)\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -5.1e230 or -1.84999999999999999e92 < (*.f64 x y) < -6.00000000000000021e73 or 2.8000000000000001e233 < (*.f64 x y) Initial program 92.3%
Taylor expanded in x around inf 89.3%
if -5.1e230 < (*.f64 x y) < -1.84999999999999999e92 or -6.00000000000000021e73 < (*.f64 x y) < 2.8000000000000001e233Initial program 99.5%
Taylor expanded in x around 0 81.2%
Final simplification82.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -1e+100) (not (<= (* a b) 1e+18))) (* a (+ b (/ (* z t) a))) (+ (* x y) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -1e+100) || !((a * b) <= 1e+18)) {
tmp = a * (b + ((z * t) / a));
} 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) <= (-1d+100)) .or. (.not. ((a * b) <= 1d+18))) then
tmp = a * (b + ((z * t) / a))
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) <= -1e+100) || !((a * b) <= 1e+18)) {
tmp = a * (b + ((z * t) / a));
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -1e+100) or not ((a * b) <= 1e+18): tmp = a * (b + ((z * t) / a)) else: tmp = (x * y) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -1e+100) || !(Float64(a * b) <= 1e+18)) tmp = Float64(a * Float64(b + Float64(Float64(z * t) / a))); 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) <= -1e+100) || ~(((a * b) <= 1e+18))) tmp = a * (b + ((z * t) / a)); 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], -1e+100], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+18]], $MachinePrecision]], N[(a * N[(b + N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+100} \lor \neg \left(a \cdot b \leq 10^{+18}\right):\\
\;\;\;\;a \cdot \left(b + \frac{z \cdot t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000002e100 or 1e18 < (*.f64 a b) Initial program 96.1%
Taylor expanded in a around inf 98.1%
Taylor expanded in x around 0 87.8%
if -1.00000000000000002e100 < (*.f64 a b) < 1e18Initial program 99.3%
Taylor expanded in a around 0 87.6%
Final simplification87.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* z t) -0.0005) (not (<= (* z t) 2e+109))) (+ (* a b) (* z t)) (+ (* x y) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((z * t) <= -0.0005) || !((z * t) <= 2e+109)) {
tmp = (a * b) + (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 (((z * t) <= (-0.0005d0)) .or. (.not. ((z * t) <= 2d+109))) then
tmp = (a * b) + (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 (((z * t) <= -0.0005) || !((z * t) <= 2e+109)) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((z * t) <= -0.0005) or not ((z * t) <= 2e+109): tmp = (a * b) + (z * t) else: tmp = (x * y) + (a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(z * t) <= -0.0005) || !(Float64(z * t) <= 2e+109)) tmp = Float64(Float64(a * b) + 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 (((z * t) <= -0.0005) || ~(((z * t) <= 2e+109))) tmp = (a * b) + (z * t); else tmp = (x * y) + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -0.0005], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+109]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -0.0005 \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+109}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000001e-4 or 1.99999999999999996e109 < (*.f64 z t) Initial program 95.9%
Taylor expanded in x around 0 87.7%
if -5.0000000000000001e-4 < (*.f64 z t) < 1.99999999999999996e109Initial program 99.3%
Taylor expanded in z around 0 88.0%
Final simplification87.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -7.4e+185) (not (<= (* a b) 3.3e+38))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -7.4e+185) || !((a * b) <= 3.3e+38)) {
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) <= (-7.4d+185)) .or. (.not. ((a * b) <= 3.3d+38))) 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) <= -7.4e+185) || !((a * b) <= 3.3e+38)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -7.4e+185) or not ((a * b) <= 3.3e+38): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -7.4e+185) || !(Float64(a * b) <= 3.3e+38)) 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) <= -7.4e+185) || ~(((a * b) <= 3.3e+38))) 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], -7.4e+185], N[Not[LessEqual[N[(a * b), $MachinePrecision], 3.3e+38]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.4 \cdot 10^{+185} \lor \neg \left(a \cdot b \leq 3.3 \cdot 10^{+38}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -7.3999999999999995e185 or 3.2999999999999999e38 < (*.f64 a b) Initial program 95.5%
Taylor expanded in a around inf 75.9%
if -7.3999999999999995e185 < (*.f64 a b) < 3.2999999999999999e38Initial program 99.4%
Taylor expanded in z around inf 47.5%
Final simplification57.3%
(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%
Taylor expanded in a around inf 35.1%
herbie shell --seed 2024095
(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)))