
(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 (if (<= (+ (+ (* x y) (* z t)) (* a b)) INFINITY) (fma a b (fma x y (* z t))) (* a (+ b (/ (* x y) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((((x * y) + (z * t)) + (a * b)) <= ((double) INFINITY)) {
tmp = fma(a, b, fma(x, y, (z * t)));
} else {
tmp = a * (b + ((x * y) / a));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) <= Inf) tmp = fma(a, b, fma(x, y, Float64(z * t))); else tmp = Float64(a * Float64(b + Float64(Float64(x * y) / a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(b + N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot y + z \cdot t\right) + a \cdot b \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(b + \frac{x \cdot y}{a}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
+-commutative100.0%
fma-define100.0%
fma-define100.0%
Simplified100.0%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in x around inf 85.7%
Taylor expanded in a around inf 100.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -5e+132)
(* a b)
(if (<= (* a b) -3.2e-308)
(* z t)
(if (<= (* a b) 1.8e-209)
(* x y)
(if (<= (* a b) 2.4e+77)
(* z t)
(if (or (<= (* a b) 1.8e+96) (not (<= (* a b) 1.35e+153)))
(* a b)
(* x y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -5e+132) {
tmp = a * b;
} else if ((a * b) <= -3.2e-308) {
tmp = z * t;
} else if ((a * b) <= 1.8e-209) {
tmp = x * y;
} else if ((a * b) <= 2.4e+77) {
tmp = z * t;
} else if (((a * b) <= 1.8e+96) || !((a * b) <= 1.35e+153)) {
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) <= (-5d+132)) then
tmp = a * b
else if ((a * b) <= (-3.2d-308)) then
tmp = z * t
else if ((a * b) <= 1.8d-209) then
tmp = x * y
else if ((a * b) <= 2.4d+77) then
tmp = z * t
else if (((a * b) <= 1.8d+96) .or. (.not. ((a * b) <= 1.35d+153))) 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) <= -5e+132) {
tmp = a * b;
} else if ((a * b) <= -3.2e-308) {
tmp = z * t;
} else if ((a * b) <= 1.8e-209) {
tmp = x * y;
} else if ((a * b) <= 2.4e+77) {
tmp = z * t;
} else if (((a * b) <= 1.8e+96) || !((a * b) <= 1.35e+153)) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -5e+132: tmp = a * b elif (a * b) <= -3.2e-308: tmp = z * t elif (a * b) <= 1.8e-209: tmp = x * y elif (a * b) <= 2.4e+77: tmp = z * t elif ((a * b) <= 1.8e+96) or not ((a * b) <= 1.35e+153): tmp = a * b else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -5e+132) tmp = Float64(a * b); elseif (Float64(a * b) <= -3.2e-308) tmp = Float64(z * t); elseif (Float64(a * b) <= 1.8e-209) tmp = Float64(x * y); elseif (Float64(a * b) <= 2.4e+77) tmp = Float64(z * t); elseif ((Float64(a * b) <= 1.8e+96) || !(Float64(a * b) <= 1.35e+153)) 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) <= -5e+132) tmp = a * b; elseif ((a * b) <= -3.2e-308) tmp = z * t; elseif ((a * b) <= 1.8e-209) tmp = x * y; elseif ((a * b) <= 2.4e+77) tmp = z * t; elseif (((a * b) <= 1.8e+96) || ~(((a * b) <= 1.35e+153))) tmp = a * b; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -5e+132], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -3.2e-308], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.8e-209], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.4e+77], N[(z * t), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], 1.8e+96], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.35e+153]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+132}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -3.2 \cdot 10^{-308}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.8 \cdot 10^{-209}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 2.4 \cdot 10^{+77}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.8 \cdot 10^{+96} \lor \neg \left(a \cdot b \leq 1.35 \cdot 10^{+153}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -5.0000000000000001e132 or 2.3999999999999999e77 < (*.f64 a b) < 1.80000000000000007e96 or 1.35e153 < (*.f64 a b) Initial program 95.2%
Taylor expanded in a around inf 77.0%
if -5.0000000000000001e132 < (*.f64 a b) < -3.2000000000000001e-308 or 1.80000000000000008e-209 < (*.f64 a b) < 2.3999999999999999e77Initial program 98.4%
Taylor expanded in y around inf 89.0%
associate-+r+89.0%
associate-/l*82.6%
associate-/l*79.4%
Simplified79.4%
Taylor expanded in t around inf 55.8%
if -3.2000000000000001e-308 < (*.f64 a b) < 1.80000000000000008e-209 or 1.80000000000000007e96 < (*.f64 a b) < 1.35e153Initial program 98.0%
Taylor expanded in y around inf 88.8%
associate-+r+88.8%
associate-/l*88.8%
associate-/l*88.7%
Simplified88.7%
Taylor expanded in x around inf 67.5%
Final simplification65.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (* x y) (* z t)) (* a b)))) (if (<= t_1 INFINITY) t_1 (* a (+ b (/ (* x y) a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x * y) + (z * t)) + (a * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = a * (b + ((x * y) / a));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x * y) + (z * t)) + (a * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = a * (b + ((x * y) / a));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((x * y) + (z * t)) + (a * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = a * (b + ((x * y) / a)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(a * Float64(b + Float64(Float64(x * y) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((x * y) + (z * t)) + (a * b); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = a * (b + ((x * y) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(a * N[(b + N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y + z \cdot t\right) + a \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(b + \frac{x \cdot y}{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 x around inf 85.7%
Taylor expanded in a around inf 100.0%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -5e+134) (+ (* x y) (* a b)) (if (<= (* x y) 5e+87) (+ (* 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 ((x * y) <= -5e+134) {
tmp = (x * y) + (a * b);
} else if ((x * y) <= 5e+87) {
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 ((x * y) <= (-5d+134)) then
tmp = (x * y) + (a * b)
else if ((x * y) <= 5d+87) 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 ((x * y) <= -5e+134) {
tmp = (x * y) + (a * b);
} else if ((x * y) <= 5e+87) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -5e+134: tmp = (x * y) + (a * b) elif (x * y) <= 5e+87: 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(x * y) <= -5e+134) tmp = Float64(Float64(x * y) + Float64(a * b)); elseif (Float64(x * y) <= 5e+87) 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 ((x * y) <= -5e+134) tmp = (x * y) + (a * b); elseif ((x * y) <= 5e+87) tmp = (a * b) + (z * t); else tmp = (x * y) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+134], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+87], 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}\;x \cdot y \leq -5 \cdot 10^{+134}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+87}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999981e134Initial program 88.6%
Taylor expanded in x around inf 91.6%
if -4.99999999999999981e134 < (*.f64 x y) < 4.9999999999999998e87Initial program 98.8%
Taylor expanded in x around 0 89.8%
if 4.9999999999999998e87 < (*.f64 x y) Initial program 98.0%
Taylor expanded in y around inf 98.0%
associate-+r+98.0%
associate-/l*100.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in a around 0 93.6%
Taylor expanded in y around 0 93.6%
Final simplification90.8%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -5e+134) (* x y) (if (<= (* x y) 5e+87) (+ (* 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 ((x * y) <= -5e+134) {
tmp = x * y;
} else if ((x * y) <= 5e+87) {
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 ((x * y) <= (-5d+134)) then
tmp = x * y
else if ((x * y) <= 5d+87) 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 ((x * y) <= -5e+134) {
tmp = x * y;
} else if ((x * y) <= 5e+87) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -5e+134: tmp = x * y elif (x * y) <= 5e+87: 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(x * y) <= -5e+134) tmp = Float64(x * y); elseif (Float64(x * y) <= 5e+87) 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 ((x * y) <= -5e+134) tmp = x * y; elseif ((x * y) <= 5e+87) tmp = (a * b) + (z * t); else tmp = (x * y) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+134], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+87], 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}\;x \cdot y \leq -5 \cdot 10^{+134}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+87}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999981e134Initial program 88.6%
Taylor expanded in y around inf 88.5%
associate-+r+88.5%
associate-/l*88.5%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 81.0%
if -4.99999999999999981e134 < (*.f64 x y) < 4.9999999999999998e87Initial program 98.8%
Taylor expanded in x around 0 89.8%
if 4.9999999999999998e87 < (*.f64 x y) Initial program 98.0%
Taylor expanded in y around inf 98.0%
associate-+r+98.0%
associate-/l*100.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in a around 0 93.6%
Taylor expanded in y around 0 93.6%
Final simplification89.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -2.5e+132) (not (<= x 9e+15))) (* x y) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -2.5e+132) || !(x <= 9e+15)) {
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 <= (-2.5d+132)) .or. (.not. (x <= 9d+15))) 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 <= -2.5e+132) || !(x <= 9e+15)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -2.5e+132) or not (x <= 9e+15): tmp = x * y else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -2.5e+132) || !(x <= 9e+15)) 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 <= -2.5e+132) || ~((x <= 9e+15))) tmp = x * y; else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -2.5e+132], N[Not[LessEqual[x, 9e+15]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+132} \lor \neg \left(x \leq 9 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if x < -2.5000000000000001e132 or 9e15 < x Initial program 94.2%
Taylor expanded in y around inf 82.2%
associate-+r+82.2%
associate-/l*81.3%
associate-/l*84.2%
Simplified84.2%
Taylor expanded in x around inf 60.4%
if -2.5000000000000001e132 < x < 9e15Initial program 99.3%
Taylor expanded in x around 0 85.7%
Final simplification75.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -4.6e+132) (not (<= (* a b) 3.4e+77))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -4.6e+132) || !((a * b) <= 3.4e+77)) {
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) <= (-4.6d+132)) .or. (.not. ((a * b) <= 3.4d+77))) 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) <= -4.6e+132) || !((a * b) <= 3.4e+77)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -4.6e+132) or not ((a * b) <= 3.4e+77): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -4.6e+132) || !(Float64(a * b) <= 3.4e+77)) 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) <= -4.6e+132) || ~(((a * b) <= 3.4e+77))) 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], -4.6e+132], N[Not[LessEqual[N[(a * b), $MachinePrecision], 3.4e+77]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.6 \cdot 10^{+132} \lor \neg \left(a \cdot b \leq 3.4 \cdot 10^{+77}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -4.6000000000000003e132 or 3.39999999999999997e77 < (*.f64 a b) Initial program 95.6%
Taylor expanded in a around inf 70.8%
if -4.6000000000000003e132 < (*.f64 a b) < 3.39999999999999997e77Initial program 98.2%
Taylor expanded in y around inf 88.9%
associate-+r+88.9%
associate-/l*84.1%
associate-/l*81.7%
Simplified81.7%
Taylor expanded in t around inf 50.1%
Final simplification57.5%
(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.3%
Taylor expanded in a around inf 34.1%
herbie shell --seed 2024091
(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)))