
(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 7 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 (* y (+ x (/ (* a b) y))))))
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 = y * (x + ((a * b) / y));
}
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 = y * (x + ((a * b) / y));
}
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 = y * (x + ((a * b) / y)) 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(y * Float64(x + Float64(Float64(a * b) / y))); 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 = y * (x + ((a * b) / y)); 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[(y * N[(x + N[(N[(a * b), $MachinePrecision] / y), $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}:\\
\;\;\;\;y \cdot \left(x + \frac{a \cdot b}{y}\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 y around inf
associate-+r+N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6433.3%
Simplified33.3%
Taylor expanded in t around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6466.7%
Simplified66.7%
Final simplification99.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))) (t_2 (+ (* x y) (* a b))))
(if (<= (* a b) -2e+193)
t_2
(if (<= (* a b) -5e+79)
t_1
(if (<= (* a b) 2e-19)
(+ (* x y) (* z t))
(if (<= (* a b) 1e+117) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + (z * t);
double t_2 = (x * y) + (a * b);
double tmp;
if ((a * b) <= -2e+193) {
tmp = t_2;
} else if ((a * b) <= -5e+79) {
tmp = t_1;
} else if ((a * b) <= 2e-19) {
tmp = (x * y) + (z * t);
} else if ((a * b) <= 1e+117) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (a * b) + (z * t)
t_2 = (x * y) + (a * b)
if ((a * b) <= (-2d+193)) then
tmp = t_2
else if ((a * b) <= (-5d+79)) then
tmp = t_1
else if ((a * b) <= 2d-19) then
tmp = (x * y) + (z * t)
else if ((a * b) <= 1d+117) then
tmp = t_1
else
tmp = t_2
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 = (a * b) + (z * t);
double t_2 = (x * y) + (a * b);
double tmp;
if ((a * b) <= -2e+193) {
tmp = t_2;
} else if ((a * b) <= -5e+79) {
tmp = t_1;
} else if ((a * b) <= 2e-19) {
tmp = (x * y) + (z * t);
} else if ((a * b) <= 1e+117) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * b) + (z * t) t_2 = (x * y) + (a * b) tmp = 0 if (a * b) <= -2e+193: tmp = t_2 elif (a * b) <= -5e+79: tmp = t_1 elif (a * b) <= 2e-19: tmp = (x * y) + (z * t) elif (a * b) <= 1e+117: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(z * t)) t_2 = Float64(Float64(x * y) + Float64(a * b)) tmp = 0.0 if (Float64(a * b) <= -2e+193) tmp = t_2; elseif (Float64(a * b) <= -5e+79) tmp = t_1; elseif (Float64(a * b) <= 2e-19) tmp = Float64(Float64(x * y) + Float64(z * t)); elseif (Float64(a * b) <= 1e+117) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * b) + (z * t); t_2 = (x * y) + (a * b); tmp = 0.0; if ((a * b) <= -2e+193) tmp = t_2; elseif ((a * b) <= -5e+79) tmp = t_1; elseif ((a * b) <= 2e-19) tmp = (x * y) + (z * t); elseif ((a * b) <= 1e+117) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -2e+193], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -5e+79], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2e-19], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+117], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := x \cdot y + a \cdot b\\
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+193}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-19}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000013e193 or 1.00000000000000005e117 < (*.f64 a b) Initial program 94.0%
Taylor expanded in x around inf
*-lowering-*.f6494.0%
Simplified94.0%
if -2.00000000000000013e193 < (*.f64 a b) < -5e79 or 2e-19 < (*.f64 a b) < 1.00000000000000005e117Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6487.0%
Simplified87.0%
if -5e79 < (*.f64 a b) < 2e-19Initial program 99.2%
Taylor expanded in a around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6489.4%
Simplified89.4%
Final simplification90.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -4.8e+181)
(* a b)
(if (<= (* a b) -6.6e-285)
(* z t)
(if (<= (* a b) 0.00185) (* x y) (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -4.8e+181) {
tmp = a * b;
} else if ((a * b) <= -6.6e-285) {
tmp = z * t;
} else if ((a * b) <= 0.00185) {
tmp = x * y;
} 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.8d+181)) then
tmp = a * b
else if ((a * b) <= (-6.6d-285)) then
tmp = z * t
else if ((a * b) <= 0.00185d0) then
tmp = x * y
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.8e+181) {
tmp = a * b;
} else if ((a * b) <= -6.6e-285) {
tmp = z * t;
} else if ((a * b) <= 0.00185) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -4.8e+181: tmp = a * b elif (a * b) <= -6.6e-285: tmp = z * t elif (a * b) <= 0.00185: tmp = x * y else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -4.8e+181) tmp = Float64(a * b); elseif (Float64(a * b) <= -6.6e-285) tmp = Float64(z * t); elseif (Float64(a * b) <= 0.00185) tmp = Float64(x * y); 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.8e+181) tmp = a * b; elseif ((a * b) <= -6.6e-285) tmp = z * t; elseif ((a * b) <= 0.00185) tmp = x * y; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -4.8e+181], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -6.6e-285], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 0.00185], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.8 \cdot 10^{+181}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -6.6 \cdot 10^{-285}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 0.00185:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -4.80000000000000004e181 or 0.0018500000000000001 < (*.f64 a b) Initial program 95.2%
Taylor expanded in a around inf
*-lowering-*.f6474.4%
Simplified74.4%
if -4.80000000000000004e181 < (*.f64 a b) < -6.5999999999999997e-285Initial program 100.0%
Taylor expanded in z around inf
*-lowering-*.f6446.2%
Simplified46.2%
if -6.5999999999999997e-285 < (*.f64 a b) < 0.0018500000000000001Initial program 98.7%
Taylor expanded in x around inf
*-lowering-*.f6458.7%
Simplified58.7%
Final simplification61.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))))
(if (<= (* a b) -4.8e+79)
t_1
(if (<= (* a b) 1.75e-13) (+ (* x y) (* z t)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + (z * t);
double tmp;
if ((a * b) <= -4.8e+79) {
tmp = t_1;
} else if ((a * b) <= 1.75e-13) {
tmp = (x * y) + (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 = (a * b) + (z * t)
if ((a * b) <= (-4.8d+79)) then
tmp = t_1
else if ((a * b) <= 1.75d-13) then
tmp = (x * y) + (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 = (a * b) + (z * t);
double tmp;
if ((a * b) <= -4.8e+79) {
tmp = t_1;
} else if ((a * b) <= 1.75e-13) {
tmp = (x * y) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * b) + (z * t) tmp = 0 if (a * b) <= -4.8e+79: tmp = t_1 elif (a * b) <= 1.75e-13: tmp = (x * y) + (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(z * t)) tmp = 0.0 if (Float64(a * b) <= -4.8e+79) tmp = t_1; elseif (Float64(a * b) <= 1.75e-13) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * b) + (z * t); tmp = 0.0; if ((a * b) <= -4.8e+79) tmp = t_1; elseif ((a * b) <= 1.75e-13) tmp = (x * y) + (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -4.8e+79], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1.75e-13], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -4.8 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -4.79999999999999971e79 or 1.7500000000000001e-13 < (*.f64 a b) Initial program 95.9%
Taylor expanded in x around 0
*-lowering-*.f6483.1%
Simplified83.1%
if -4.79999999999999971e79 < (*.f64 a b) < 1.7500000000000001e-13Initial program 99.2%
Taylor expanded in a around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6489.4%
Simplified89.4%
Final simplification86.4%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -2.6e+164) (* x y) (if (<= (* x y) 8.6e+68) (+ (* 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) <= -2.6e+164) {
tmp = x * y;
} else if ((x * y) <= 8.6e+68) {
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) <= (-2.6d+164)) then
tmp = x * y
else if ((x * y) <= 8.6d+68) 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) <= -2.6e+164) {
tmp = x * y;
} else if ((x * y) <= 8.6e+68) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -2.6e+164: tmp = x * y elif (x * y) <= 8.6e+68: 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) <= -2.6e+164) tmp = Float64(x * y); elseif (Float64(x * y) <= 8.6e+68) 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) <= -2.6e+164) tmp = x * y; elseif ((x * y) <= 8.6e+68) 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], -2.6e+164], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 8.6e+68], 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 -2.6 \cdot 10^{+164}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 8.6 \cdot 10^{+68}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -2.5999999999999999e164 or 8.6000000000000002e68 < (*.f64 x y) Initial program 94.6%
Taylor expanded in x around inf
*-lowering-*.f6474.6%
Simplified74.6%
if -2.5999999999999999e164 < (*.f64 x y) < 8.6000000000000002e68Initial program 99.4%
Taylor expanded in x around 0
*-lowering-*.f6485.6%
Simplified85.6%
Final simplification81.6%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -4.8e+181) (* a b) (if (<= (* a b) 20.0) (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -4.8e+181) {
tmp = a * b;
} else if ((a * b) <= 20.0) {
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.8d+181)) then
tmp = a * b
else if ((a * b) <= 20.0d0) 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.8e+181) {
tmp = a * b;
} else if ((a * b) <= 20.0) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -4.8e+181: tmp = a * b elif (a * b) <= 20.0: 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.8e+181) tmp = Float64(a * b); elseif (Float64(a * b) <= 20.0) 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.8e+181) tmp = a * b; elseif ((a * b) <= 20.0) 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.8e+181], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 20.0], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.8 \cdot 10^{+181}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 20:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -4.80000000000000004e181 or 20 < (*.f64 a b) Initial program 95.2%
Taylor expanded in a around inf
*-lowering-*.f6475.0%
Simplified75.0%
if -4.80000000000000004e181 < (*.f64 a b) < 20Initial program 99.3%
Taylor expanded in z around inf
*-lowering-*.f6443.2%
Simplified43.2%
Final simplification56.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
*-lowering-*.f6439.4%
Simplified39.4%
herbie shell --seed 2024138
(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)))