
(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 a b (fma x y (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(a, b, fma(x, y, (z * t)));
}
function code(x, y, z, t, a, b) return fma(a, b, fma(x, y, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)
\end{array}
Initial program 98.8%
+-commutative98.8%
fma-define99.2%
fma-define99.2%
Simplified99.2%
(FPCore (x y z t a b) :precision binary64 (+ (fma x y (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, (z * t)) + (a * b);
}
function code(x, y, z, t, a, b) return Float64(fma(x, y, Float64(z * t)) + Float64(a * b)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b
\end{array}
Initial program 98.8%
fma-define98.8%
Simplified98.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -4.8e+32)
(* x y)
(if (<= (* x y) -3.7e-171)
(* z t)
(if (<= (* x y) 2.85e-257)
(* a b)
(if (<= (* x y) 1.25e-122)
(* z t)
(if (<= (* x y) 2.8e-78) (* a b) (* x y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -4.8e+32) {
tmp = x * y;
} else if ((x * y) <= -3.7e-171) {
tmp = z * t;
} else if ((x * y) <= 2.85e-257) {
tmp = a * b;
} else if ((x * y) <= 1.25e-122) {
tmp = z * t;
} else if ((x * y) <= 2.8e-78) {
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) <= (-4.8d+32)) then
tmp = x * y
else if ((x * y) <= (-3.7d-171)) then
tmp = z * t
else if ((x * y) <= 2.85d-257) then
tmp = a * b
else if ((x * y) <= 1.25d-122) then
tmp = z * t
else if ((x * y) <= 2.8d-78) 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) <= -4.8e+32) {
tmp = x * y;
} else if ((x * y) <= -3.7e-171) {
tmp = z * t;
} else if ((x * y) <= 2.85e-257) {
tmp = a * b;
} else if ((x * y) <= 1.25e-122) {
tmp = z * t;
} else if ((x * y) <= 2.8e-78) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -4.8e+32: tmp = x * y elif (x * y) <= -3.7e-171: tmp = z * t elif (x * y) <= 2.85e-257: tmp = a * b elif (x * y) <= 1.25e-122: tmp = z * t elif (x * y) <= 2.8e-78: tmp = a * b else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -4.8e+32) tmp = Float64(x * y); elseif (Float64(x * y) <= -3.7e-171) tmp = Float64(z * t); elseif (Float64(x * y) <= 2.85e-257) tmp = Float64(a * b); elseif (Float64(x * y) <= 1.25e-122) tmp = Float64(z * t); elseif (Float64(x * y) <= 2.8e-78) 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) <= -4.8e+32) tmp = x * y; elseif ((x * y) <= -3.7e-171) tmp = z * t; elseif ((x * y) <= 2.85e-257) tmp = a * b; elseif ((x * y) <= 1.25e-122) tmp = z * t; elseif ((x * y) <= 2.8e-78) 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], -4.8e+32], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -3.7e-171], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.85e-257], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.25e-122], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.8e-78], N[(a * b), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4.8 \cdot 10^{+32}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -3.7 \cdot 10^{-171}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 2.85 \cdot 10^{-257}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 1.25 \cdot 10^{-122}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 2.8 \cdot 10^{-78}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -4.79999999999999983e32 or 2.80000000000000024e-78 < (*.f64 x y) Initial program 97.8%
Taylor expanded in z around inf 78.3%
+-commutative78.3%
associate-/l*74.7%
associate-/l*73.0%
Simplified73.0%
Taylor expanded in x around inf 65.8%
if -4.79999999999999983e32 < (*.f64 x y) < -3.70000000000000012e-171 or 2.8499999999999999e-257 < (*.f64 x y) < 1.25e-122Initial program 100.0%
Taylor expanded in z around inf 96.9%
+-commutative96.9%
associate-/l*89.3%
associate-/l*86.0%
Simplified86.0%
Taylor expanded in z around inf 58.0%
if -3.70000000000000012e-171 < (*.f64 x y) < 2.8499999999999999e-257 or 1.25e-122 < (*.f64 x y) < 2.80000000000000024e-78Initial program 100.0%
Taylor expanded in a around inf 66.3%
Final simplification63.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))))
(if (<= t -2.8e-27)
t_1
(if (<= t 2.75e+72)
(+ (* a b) (* x y))
(if (or (<= t 1.9e+152) (not (<= t 3.1e+169)))
(+ (* 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 (t <= -2.8e-27) {
tmp = t_1;
} else if (t <= 2.75e+72) {
tmp = (a * b) + (x * y);
} else if ((t <= 1.9e+152) || !(t <= 3.1e+169)) {
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 (t <= (-2.8d-27)) then
tmp = t_1
else if (t <= 2.75d+72) then
tmp = (a * b) + (x * y)
else if ((t <= 1.9d+152) .or. (.not. (t <= 3.1d+169))) 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 (t <= -2.8e-27) {
tmp = t_1;
} else if (t <= 2.75e+72) {
tmp = (a * b) + (x * y);
} else if ((t <= 1.9e+152) || !(t <= 3.1e+169)) {
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 t <= -2.8e-27: tmp = t_1 elif t <= 2.75e+72: tmp = (a * b) + (x * y) elif (t <= 1.9e+152) or not (t <= 3.1e+169): 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 (t <= -2.8e-27) tmp = t_1; elseif (t <= 2.75e+72) tmp = Float64(Float64(a * b) + Float64(x * y)); elseif ((t <= 1.9e+152) || !(t <= 3.1e+169)) 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 (t <= -2.8e-27) tmp = t_1; elseif (t <= 2.75e+72) tmp = (a * b) + (x * y); elseif ((t <= 1.9e+152) || ~((t <= 3.1e+169))) 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[t, -2.8e-27], t$95$1, If[LessEqual[t, 2.75e+72], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 1.9e+152], N[Not[LessEqual[t, 3.1e+169]], $MachinePrecision]], 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}\;t \leq -2.8 \cdot 10^{-27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.75 \cdot 10^{+72}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{+152} \lor \neg \left(t \leq 3.1 \cdot 10^{+169}\right):\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.8e-27 or 1.9e152 < t < 3.1e169Initial program 98.6%
Taylor expanded in x around 0 77.7%
if -2.8e-27 < t < 2.75e72Initial program 100.0%
Taylor expanded in x around inf 85.6%
if 2.75e72 < t < 1.9e152 or 3.1e169 < t Initial program 94.6%
Taylor expanded in z around inf 89.7%
+-commutative89.7%
associate-/l*79.1%
associate-/l*79.0%
Simplified79.0%
Taylor expanded in a around 0 89.7%
Taylor expanded in z around 0 92.0%
Final simplification84.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (+ t (/ (* x y) z)))))
(if (<= z -4.3e+161)
t_1
(if (<= z -8.5e+44)
(+ (* a b) (* z t))
(if (<= z 3.1e-60) (+ (* a b) (* x y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (t + ((x * y) / z));
double tmp;
if (z <= -4.3e+161) {
tmp = t_1;
} else if (z <= -8.5e+44) {
tmp = (a * b) + (z * t);
} else if (z <= 3.1e-60) {
tmp = (a * b) + (x * y);
} 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 = z * (t + ((x * y) / z))
if (z <= (-4.3d+161)) then
tmp = t_1
else if (z <= (-8.5d+44)) then
tmp = (a * b) + (z * t)
else if (z <= 3.1d-60) then
tmp = (a * b) + (x * y)
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 = z * (t + ((x * y) / z));
double tmp;
if (z <= -4.3e+161) {
tmp = t_1;
} else if (z <= -8.5e+44) {
tmp = (a * b) + (z * t);
} else if (z <= 3.1e-60) {
tmp = (a * b) + (x * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z * (t + ((x * y) / z)) tmp = 0 if z <= -4.3e+161: tmp = t_1 elif z <= -8.5e+44: tmp = (a * b) + (z * t) elif z <= 3.1e-60: tmp = (a * b) + (x * y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(t + Float64(Float64(x * y) / z))) tmp = 0.0 if (z <= -4.3e+161) tmp = t_1; elseif (z <= -8.5e+44) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (z <= 3.1e-60) tmp = Float64(Float64(a * b) + Float64(x * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z * (t + ((x * y) / z)); tmp = 0.0; if (z <= -4.3e+161) tmp = t_1; elseif (z <= -8.5e+44) tmp = (a * b) + (z * t); elseif (z <= 3.1e-60) tmp = (a * b) + (x * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(t + N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.3e+161], t$95$1, If[LessEqual[z, -8.5e+44], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.1e-60], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(t + \frac{x \cdot y}{z}\right)\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{+161}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+44}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-60}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.3e161 or 3.09999999999999988e-60 < z Initial program 96.9%
Taylor expanded in z around inf 98.0%
+-commutative98.0%
associate-/l*97.9%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in a around 0 78.8%
if -4.3e161 < z < -8.5e44Initial program 100.0%
Taylor expanded in x around 0 90.5%
if -8.5e44 < z < 3.09999999999999988e-60Initial program 100.0%
Taylor expanded in x around inf 88.9%
Final simplification85.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -1.85e-26) (not (<= (* x y) 3.3e-78))) (+ (* 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) <= -1.85e-26) || !((x * y) <= 3.3e-78)) {
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) <= (-1.85d-26)) .or. (.not. ((x * y) <= 3.3d-78))) 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) <= -1.85e-26) || !((x * y) <= 3.3e-78)) {
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) <= -1.85e-26) or not ((x * y) <= 3.3e-78): 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) <= -1.85e-26) || !(Float64(x * y) <= 3.3e-78)) 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) <= -1.85e-26) || ~(((x * y) <= 3.3e-78))) 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], -1.85e-26], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3.3e-78]], $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 -1.85 \cdot 10^{-26} \lor \neg \left(x \cdot y \leq 3.3 \cdot 10^{-78}\right):\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -1.8499999999999999e-26 or 3.29999999999999982e-78 < (*.f64 x y) Initial program 98.0%
Taylor expanded in z around inf 79.5%
+-commutative79.5%
associate-/l*74.3%
associate-/l*72.8%
Simplified72.8%
Taylor expanded in a around 0 69.9%
Taylor expanded in z around 0 81.5%
if -1.8499999999999999e-26 < (*.f64 x y) < 3.29999999999999982e-78Initial program 100.0%
Taylor expanded in x around 0 94.9%
Final simplification86.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -4.9e+123) (not (<= (* x y) 5e+236))) (* 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) <= -4.9e+123) || !((x * y) <= 5e+236)) {
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) <= (-4.9d+123)) .or. (.not. ((x * y) <= 5d+236))) 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) <= -4.9e+123) || !((x * y) <= 5e+236)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -4.9e+123) or not ((x * y) <= 5e+236): 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) <= -4.9e+123) || !(Float64(x * y) <= 5e+236)) 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) <= -4.9e+123) || ~(((x * y) <= 5e+236))) 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], -4.9e+123], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+236]], $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 -4.9 \cdot 10^{+123} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+236}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -4.89999999999999976e123 or 4.9999999999999997e236 < (*.f64 x y) Initial program 95.7%
Taylor expanded in z around inf 75.7%
+-commutative75.7%
associate-/l*74.2%
associate-/l*72.6%
Simplified72.6%
Taylor expanded in x around inf 90.0%
if -4.89999999999999976e123 < (*.f64 x y) < 4.9999999999999997e236Initial program 100.0%
Taylor expanded in x around 0 80.6%
Final simplification83.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -4500000.0) (not (<= (* a b) 1.02e+93))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -4500000.0) || !((a * b) <= 1.02e+93)) {
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) <= (-4500000.0d0)) .or. (.not. ((a * b) <= 1.02d+93))) 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) <= -4500000.0) || !((a * b) <= 1.02e+93)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -4500000.0) or not ((a * b) <= 1.02e+93): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -4500000.0) || !(Float64(a * b) <= 1.02e+93)) 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) <= -4500000.0) || ~(((a * b) <= 1.02e+93))) 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], -4500000.0], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.02e+93]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4500000 \lor \neg \left(a \cdot b \leq 1.02 \cdot 10^{+93}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -4.5e6 or 1.0200000000000001e93 < (*.f64 a b) Initial program 98.1%
Taylor expanded in a around inf 61.2%
if -4.5e6 < (*.f64 a b) < 1.0200000000000001e93Initial program 99.3%
Taylor expanded in z around inf 86.7%
+-commutative86.7%
associate-/l*80.8%
associate-/l*78.0%
Simplified78.0%
Taylor expanded in z around inf 44.2%
Final simplification51.2%
(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.8%
Final simplification98.8%
(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.8%
Taylor expanded in a around inf 31.1%
herbie shell --seed 2024100
(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)))