
(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 9 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 (+ (* x y) (* z t)))) (if (<= (+ (* a b) t_1) INFINITY) (+ (* a b) (fma x y (* z t))) t_1)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (z * t);
double tmp;
if (((a * b) + t_1) <= ((double) INFINITY)) {
tmp = (a * b) + fma(x, y, (z * t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (Float64(Float64(a * b) + t_1) <= Inf) tmp = Float64(Float64(a * b) + fma(x, y, Float64(z * t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision], Infinity], N[(N[(a * b), $MachinePrecision] + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;a \cdot b + t_1 \leq \infty:\\
\;\;\;\;a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
fma-def100.0%
Simplified100.0%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in a around 0 66.7%
Final simplification99.2%
(FPCore (x y z t a b) :precision binary64 (fma x y (fma a b (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(a, b, (z * t)));
}
function code(x, y, z, t, a, b) return fma(x, y, fma(a, b, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\right)\right)
\end{array}
Initial program 97.6%
associate-+l+97.6%
fma-def98.0%
+-commutative98.0%
fma-def98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= (* x y) -2.2e+108)
(not
(or (<= (* x y) 0.011)
(and (not (<= (* x y) 2.9e+60)) (<= (* x y) 2.55e+135)))))
(+ (* 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.2e+108) || !(((x * y) <= 0.011) || (!((x * y) <= 2.9e+60) && ((x * y) <= 2.55e+135)))) {
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.2d+108)) .or. (.not. ((x * y) <= 0.011d0) .or. (.not. ((x * y) <= 2.9d+60)) .and. ((x * y) <= 2.55d+135))) 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.2e+108) || !(((x * y) <= 0.011) || (!((x * y) <= 2.9e+60) && ((x * y) <= 2.55e+135)))) {
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.2e+108) or not (((x * y) <= 0.011) or (not ((x * y) <= 2.9e+60) and ((x * y) <= 2.55e+135))): 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.2e+108) || !((Float64(x * y) <= 0.011) || (!(Float64(x * y) <= 2.9e+60) && (Float64(x * y) <= 2.55e+135)))) 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.2e+108) || ~((((x * y) <= 0.011) || (~(((x * y) <= 2.9e+60)) && ((x * y) <= 2.55e+135))))) 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.2e+108], N[Not[Or[LessEqual[N[(x * y), $MachinePrecision], 0.011], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.9e+60]], $MachinePrecision], LessEqual[N[(x * y), $MachinePrecision], 2.55e+135]]]], $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.2 \cdot 10^{+108} \lor \neg \left(x \cdot y \leq 0.011 \lor \neg \left(x \cdot y \leq 2.9 \cdot 10^{+60}\right) \land x \cdot y \leq 2.55 \cdot 10^{+135}\right):\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -2.2000000000000001e108 or 0.010999999999999999 < (*.f64 x y) < 2.9e60 or 2.54999999999999991e135 < (*.f64 x y) Initial program 95.8%
Taylor expanded in z around 0 87.5%
if -2.2000000000000001e108 < (*.f64 x y) < 0.010999999999999999 or 2.9e60 < (*.f64 x y) < 2.54999999999999991e135Initial program 98.7%
Taylor expanded in x around 0 91.2%
Final simplification89.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* x y) (* z t))) (t_2 (+ (* a b) t_1))) (if (<= t_2 INFINITY) t_2 t_1)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (z * t);
double t_2 = (a * b) + t_1;
double tmp;
if (t_2 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = t_1;
}
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);
double t_2 = (a * b) + t_1;
double tmp;
if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * y) + (z * t) t_2 = (a * b) + t_1 tmp = 0 if t_2 <= math.inf: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * y) + Float64(z * t)) t_2 = Float64(Float64(a * b) + t_1) tmp = 0.0 if (t_2 <= Inf) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * y) + (z * t); t_2 = (a * b) + t_1; tmp = 0.0; if (t_2 <= Inf) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, Infinity], t$95$2, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := a \cdot b + t_1\\
\mathbf{if}\;t_2 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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 0 66.7%
Final simplification99.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -1.18e+98)
(* x y)
(if (<= (* x y) 2.5e+15)
(* z t)
(if (<= (* x y) 5.2e+42)
(* a b)
(if (<= (* x y) 1.36e+135) (* z t) (* x y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -1.18e+98) {
tmp = x * y;
} else if ((x * y) <= 2.5e+15) {
tmp = z * t;
} else if ((x * y) <= 5.2e+42) {
tmp = a * b;
} else if ((x * y) <= 1.36e+135) {
tmp = 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.18d+98)) then
tmp = x * y
else if ((x * y) <= 2.5d+15) then
tmp = z * t
else if ((x * y) <= 5.2d+42) then
tmp = a * b
else if ((x * y) <= 1.36d+135) then
tmp = 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.18e+98) {
tmp = x * y;
} else if ((x * y) <= 2.5e+15) {
tmp = z * t;
} else if ((x * y) <= 5.2e+42) {
tmp = a * b;
} else if ((x * y) <= 1.36e+135) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -1.18e+98: tmp = x * y elif (x * y) <= 2.5e+15: tmp = z * t elif (x * y) <= 5.2e+42: tmp = a * b elif (x * y) <= 1.36e+135: tmp = z * t else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -1.18e+98) tmp = Float64(x * y); elseif (Float64(x * y) <= 2.5e+15) tmp = Float64(z * t); elseif (Float64(x * y) <= 5.2e+42) tmp = Float64(a * b); elseif (Float64(x * y) <= 1.36e+135) tmp = 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.18e+98) tmp = x * y; elseif ((x * y) <= 2.5e+15) tmp = z * t; elseif ((x * y) <= 5.2e+42) tmp = a * b; elseif ((x * y) <= 1.36e+135) tmp = 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.18e+98], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.5e+15], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5.2e+42], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.36e+135], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.18 \cdot 10^{+98}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 2.5 \cdot 10^{+15}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 5.2 \cdot 10^{+42}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 1.36 \cdot 10^{+135}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -1.18000000000000002e98 or 1.36000000000000007e135 < (*.f64 x y) Initial program 95.0%
Taylor expanded in x around inf 80.4%
if -1.18000000000000002e98 < (*.f64 x y) < 2.5e15 or 5.1999999999999998e42 < (*.f64 x y) < 1.36000000000000007e135Initial program 98.8%
Taylor expanded in z around inf 51.6%
if 2.5e15 < (*.f64 x y) < 5.1999999999999998e42Initial program 100.0%
Taylor expanded in a around inf 66.5%
Final simplification61.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -3.4e+104) (not (<= (* x y) 3e+154))) (* 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) <= -3.4e+104) || !((x * y) <= 3e+154)) {
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) <= (-3.4d+104)) .or. (.not. ((x * y) <= 3d+154))) 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) <= -3.4e+104) || !((x * y) <= 3e+154)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -3.4e+104) or not ((x * y) <= 3e+154): 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) <= -3.4e+104) || !(Float64(x * y) <= 3e+154)) 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) <= -3.4e+104) || ~(((x * y) <= 3e+154))) 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], -3.4e+104], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3e+154]], $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 -3.4 \cdot 10^{+104} \lor \neg \left(x \cdot y \leq 3 \cdot 10^{+154}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -3.3999999999999997e104 or 3.00000000000000026e154 < (*.f64 x y) Initial program 94.6%
Taylor expanded in x around inf 83.9%
if -3.3999999999999997e104 < (*.f64 x y) < 3.00000000000000026e154Initial program 98.9%
Taylor expanded in x around 0 87.0%
Final simplification86.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= y -3.4e-111)
t_1
(if (<= y 4.3e+92)
(+ (* a b) (* z t))
(if (<= y 2e+132) (+ (* x y) (* a b)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (z * t);
double tmp;
if (y <= -3.4e-111) {
tmp = t_1;
} else if (y <= 4.3e+92) {
tmp = (a * b) + (z * t);
} else if (y <= 2e+132) {
tmp = (x * y) + (a * b);
} 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 = (x * y) + (z * t)
if (y <= (-3.4d-111)) then
tmp = t_1
else if (y <= 4.3d+92) then
tmp = (a * b) + (z * t)
else if (y <= 2d+132) then
tmp = (x * y) + (a * b)
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 = (x * y) + (z * t);
double tmp;
if (y <= -3.4e-111) {
tmp = t_1;
} else if (y <= 4.3e+92) {
tmp = (a * b) + (z * t);
} else if (y <= 2e+132) {
tmp = (x * y) + (a * b);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * y) + (z * t) tmp = 0 if y <= -3.4e-111: tmp = t_1 elif y <= 4.3e+92: tmp = (a * b) + (z * t) elif y <= 2e+132: tmp = (x * y) + (a * b) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (y <= -3.4e-111) tmp = t_1; elseif (y <= 4.3e+92) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (y <= 2e+132) tmp = Float64(Float64(x * y) + Float64(a * b)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * y) + (z * t); tmp = 0.0; if (y <= -3.4e-111) tmp = t_1; elseif (y <= 4.3e+92) tmp = (a * b) + (z * t); elseif (y <= 2e+132) tmp = (x * y) + (a * b); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.4e-111], t$95$1, If[LessEqual[y, 4.3e+92], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+132], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;y \leq -3.4 \cdot 10^{-111}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{+92}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+132}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -3.39999999999999997e-111 or 1.99999999999999998e132 < y Initial program 96.7%
Taylor expanded in a around 0 74.9%
if -3.39999999999999997e-111 < y < 4.2999999999999998e92Initial program 99.2%
Taylor expanded in x around 0 84.9%
if 4.2999999999999998e92 < y < 1.99999999999999998e132Initial program 88.9%
Taylor expanded in z around 0 88.9%
Final simplification80.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.5e+93) (not (<= z 8.6e-8))) (* z t) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.5e+93) || !(z <= 8.6e-8)) {
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 ((z <= (-3.5d+93)) .or. (.not. (z <= 8.6d-8))) 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 ((z <= -3.5e+93) || !(z <= 8.6e-8)) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -3.5e+93) or not (z <= 8.6e-8): tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.5e+93) || !(z <= 8.6e-8)) 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 ((z <= -3.5e+93) || ~((z <= 8.6e-8))) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.5e+93], N[Not[LessEqual[z, 8.6e-8]], $MachinePrecision]], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+93} \lor \neg \left(z \leq 8.6 \cdot 10^{-8}\right):\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if z < -3.49999999999999998e93 or 8.6000000000000002e-8 < z Initial program 98.2%
Taylor expanded in z around inf 64.7%
if -3.49999999999999998e93 < z < 8.6000000000000002e-8Initial program 97.3%
Taylor expanded in a around inf 43.0%
Final simplification52.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 97.6%
Taylor expanded in a around inf 35.5%
Final simplification35.5%
herbie shell --seed 2023308
(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)))