
(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 (if (<= (+ (* a b) (+ (* x y) (* z t))) INFINITY) (+ (* a b) (fma x y (* z t))) (fma a b (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) + ((x * y) + (z * t))) <= ((double) INFINITY)) {
tmp = (a * b) + fma(x, y, (z * t));
} else {
tmp = fma(a, b, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) <= Inf) tmp = Float64(Float64(a * b) + fma(x, y, Float64(z * t))); else tmp = fma(a, b, Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(a * b), $MachinePrecision] + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b + \left(x \cdot y + z \cdot t\right) \leq \infty:\\
\;\;\;\;a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\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 z around 0 83.3%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t a b) :precision binary64 (fma x y (fma z t (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(z, t, (a * b)));
}
function code(x, y, z, t, a, b) return fma(x, y, fma(z, t, Float64(a * b))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)
\end{array}
Initial program 97.6%
associate-+l+97.6%
fma-def97.6%
fma-def98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* a b) (+ (* x y) (* z t))))) (if (<= t_1 INFINITY) t_1 (fma a b (* x 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 = fma(a, b, (x * 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 = fma(a, b, Float64(x * y)); end return 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 * b + N[(x * y), $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}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot 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 z around 0 83.3%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -2.1e+140)
(* a b)
(if (<= (* a b) -1.05e-19)
(* x y)
(if (<= (* a b) -2.35e-296)
(* z t)
(if (<= (* a b) 1.15e-200)
(* x y)
(if (<= (* a b) 2.6e+17)
(* z t)
(if (<= (* a b) 4.6e+136) (* x y) (* a b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2.1e+140) {
tmp = a * b;
} else if ((a * b) <= -1.05e-19) {
tmp = x * y;
} else if ((a * b) <= -2.35e-296) {
tmp = z * t;
} else if ((a * b) <= 1.15e-200) {
tmp = x * y;
} else if ((a * b) <= 2.6e+17) {
tmp = z * t;
} else if ((a * b) <= 4.6e+136) {
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) <= (-2.1d+140)) then
tmp = a * b
else if ((a * b) <= (-1.05d-19)) then
tmp = x * y
else if ((a * b) <= (-2.35d-296)) then
tmp = z * t
else if ((a * b) <= 1.15d-200) then
tmp = x * y
else if ((a * b) <= 2.6d+17) then
tmp = z * t
else if ((a * b) <= 4.6d+136) 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) <= -2.1e+140) {
tmp = a * b;
} else if ((a * b) <= -1.05e-19) {
tmp = x * y;
} else if ((a * b) <= -2.35e-296) {
tmp = z * t;
} else if ((a * b) <= 1.15e-200) {
tmp = x * y;
} else if ((a * b) <= 2.6e+17) {
tmp = z * t;
} else if ((a * b) <= 4.6e+136) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -2.1e+140: tmp = a * b elif (a * b) <= -1.05e-19: tmp = x * y elif (a * b) <= -2.35e-296: tmp = z * t elif (a * b) <= 1.15e-200: tmp = x * y elif (a * b) <= 2.6e+17: tmp = z * t elif (a * b) <= 4.6e+136: tmp = x * y else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -2.1e+140) tmp = Float64(a * b); elseif (Float64(a * b) <= -1.05e-19) tmp = Float64(x * y); elseif (Float64(a * b) <= -2.35e-296) tmp = Float64(z * t); elseif (Float64(a * b) <= 1.15e-200) tmp = Float64(x * y); elseif (Float64(a * b) <= 2.6e+17) tmp = Float64(z * t); elseif (Float64(a * b) <= 4.6e+136) 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) <= -2.1e+140) tmp = a * b; elseif ((a * b) <= -1.05e-19) tmp = x * y; elseif ((a * b) <= -2.35e-296) tmp = z * t; elseif ((a * b) <= 1.15e-200) tmp = x * y; elseif ((a * b) <= 2.6e+17) tmp = z * t; elseif ((a * b) <= 4.6e+136) 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], -2.1e+140], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.05e-19], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2.35e-296], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.15e-200], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.6e+17], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4.6e+136], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.1 \cdot 10^{+140}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.05 \cdot 10^{-19}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -2.35 \cdot 10^{-296}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.15 \cdot 10^{-200}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 2.6 \cdot 10^{+17}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 4.6 \cdot 10^{+136}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -2.1000000000000002e140 or 4.6e136 < (*.f64 a b) Initial program 96.5%
Taylor expanded in a around inf 67.2%
if -2.1000000000000002e140 < (*.f64 a b) < -1.0499999999999999e-19 or -2.35e-296 < (*.f64 a b) < 1.15000000000000004e-200 or 2.6e17 < (*.f64 a b) < 4.6e136Initial program 96.9%
Taylor expanded in x around inf 60.4%
if -1.0499999999999999e-19 < (*.f64 a b) < -2.35e-296 or 1.15000000000000004e-200 < (*.f64 a b) < 2.6e17Initial program 100.0%
Taylor expanded in z around inf 62.5%
Final simplification63.3%
(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) (* x 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 = (a * b) + (x * 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 = (a * b) + (x * 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 = (a * b) + (x * 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(Float64(a * b) + Float64(x * 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 = (a * b) + (x * 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[(N[(a * b), $MachinePrecision] + N[(x * y), $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 b + x \cdot y\\
\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 z around 0 83.3%
Final simplification99.6%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= z -3.6e+209)
(not
(or (<= z -2.16e+92) (and (not (<= z -3.5e+18)) (<= z 2.9e-78)))))
(+ (* a b) (* z t))
(+ (* a b) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.6e+209) || !((z <= -2.16e+92) || (!(z <= -3.5e+18) && (z <= 2.9e-78)))) {
tmp = (a * b) + (z * t);
} else {
tmp = (a * b) + (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 ((z <= (-3.6d+209)) .or. (.not. (z <= (-2.16d+92)) .or. (.not. (z <= (-3.5d+18))) .and. (z <= 2.9d-78))) then
tmp = (a * b) + (z * t)
else
tmp = (a * b) + (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 ((z <= -3.6e+209) || !((z <= -2.16e+92) || (!(z <= -3.5e+18) && (z <= 2.9e-78)))) {
tmp = (a * b) + (z * t);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -3.6e+209) or not ((z <= -2.16e+92) or (not (z <= -3.5e+18) and (z <= 2.9e-78))): tmp = (a * b) + (z * t) else: tmp = (a * b) + (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.6e+209) || !((z <= -2.16e+92) || (!(z <= -3.5e+18) && (z <= 2.9e-78)))) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(Float64(a * b) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -3.6e+209) || ~(((z <= -2.16e+92) || (~((z <= -3.5e+18)) && (z <= 2.9e-78))))) tmp = (a * b) + (z * t); else tmp = (a * b) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.6e+209], N[Not[Or[LessEqual[z, -2.16e+92], And[N[Not[LessEqual[z, -3.5e+18]], $MachinePrecision], LessEqual[z, 2.9e-78]]]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+209} \lor \neg \left(z \leq -2.16 \cdot 10^{+92} \lor \neg \left(z \leq -3.5 \cdot 10^{+18}\right) \land z \leq 2.9 \cdot 10^{-78}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\end{array}
if z < -3.60000000000000012e209 or -2.16e92 < z < -3.5e18 or 2.9000000000000001e-78 < z Initial program 94.9%
Taylor expanded in x around 0 77.1%
if -3.60000000000000012e209 < z < -2.16e92 or -3.5e18 < z < 2.9000000000000001e-78Initial program 100.0%
Taylor expanded in z around 0 85.6%
Final simplification81.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* a b) (* x y))) (t_2 (+ (* x y) (* z t))))
(if (<= z -5.8e+148)
t_2
(if (<= z -1.85e+84)
t_1
(if (<= z -1620000000.0)
t_2
(if (<= z 1.4e-75) t_1 (+ (* a b) (* z t))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + (x * y);
double t_2 = (x * y) + (z * t);
double tmp;
if (z <= -5.8e+148) {
tmp = t_2;
} else if (z <= -1.85e+84) {
tmp = t_1;
} else if (z <= -1620000000.0) {
tmp = t_2;
} else if (z <= 1.4e-75) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (a * b) + (x * y)
t_2 = (x * y) + (z * t)
if (z <= (-5.8d+148)) then
tmp = t_2
else if (z <= (-1.85d+84)) then
tmp = t_1
else if (z <= (-1620000000.0d0)) then
tmp = t_2
else if (z <= 1.4d-75) then
tmp = t_1
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 t_1 = (a * b) + (x * y);
double t_2 = (x * y) + (z * t);
double tmp;
if (z <= -5.8e+148) {
tmp = t_2;
} else if (z <= -1.85e+84) {
tmp = t_1;
} else if (z <= -1620000000.0) {
tmp = t_2;
} else if (z <= 1.4e-75) {
tmp = t_1;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * b) + (x * y) t_2 = (x * y) + (z * t) tmp = 0 if z <= -5.8e+148: tmp = t_2 elif z <= -1.85e+84: tmp = t_1 elif z <= -1620000000.0: tmp = t_2 elif z <= 1.4e-75: tmp = t_1 else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(x * y)) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (z <= -5.8e+148) tmp = t_2; elseif (z <= -1.85e+84) tmp = t_1; elseif (z <= -1620000000.0) tmp = t_2; elseif (z <= 1.4e-75) tmp = t_1; else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * b) + (x * y); t_2 = (x * y) + (z * t); tmp = 0.0; if (z <= -5.8e+148) tmp = t_2; elseif (z <= -1.85e+84) tmp = t_1; elseif (z <= -1620000000.0) tmp = t_2; elseif (z <= 1.4e-75) tmp = t_1; else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.8e+148], t$95$2, If[LessEqual[z, -1.85e+84], t$95$1, If[LessEqual[z, -1620000000.0], t$95$2, If[LessEqual[z, 1.4e-75], t$95$1, N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;z \leq -5.8 \cdot 10^{+148}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{+84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1620000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-75}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if z < -5.7999999999999999e148 or -1.85e84 < z < -1.62e9Initial program 95.1%
Taylor expanded in a around 0 80.1%
if -5.7999999999999999e148 < z < -1.85e84 or -1.62e9 < z < 1.39999999999999999e-75Initial program 100.0%
Taylor expanded in z around 0 86.4%
if 1.39999999999999999e-75 < z Initial program 95.2%
Taylor expanded in x around 0 74.6%
Final simplification81.5%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -3.6e-6) (* a b) (if (<= (* a b) 4.5e+27) (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -3.6e-6) {
tmp = a * b;
} else if ((a * b) <= 4.5e+27) {
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) <= (-3.6d-6)) then
tmp = a * b
else if ((a * b) <= 4.5d+27) 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) <= -3.6e-6) {
tmp = a * b;
} else if ((a * b) <= 4.5e+27) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -3.6e-6: tmp = a * b elif (a * b) <= 4.5e+27: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -3.6e-6) tmp = Float64(a * b); elseif (Float64(a * b) <= 4.5e+27) 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) <= -3.6e-6) tmp = a * b; elseif ((a * b) <= 4.5e+27) 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], -3.6e-6], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4.5e+27], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3.6 \cdot 10^{-6}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 4.5 \cdot 10^{+27}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -3.59999999999999984e-6 or 4.4999999999999999e27 < (*.f64 a b) Initial program 97.0%
Taylor expanded in a around inf 54.2%
if -3.59999999999999984e-6 < (*.f64 a b) < 4.4999999999999999e27Initial program 98.3%
Taylor expanded in z around inf 49.8%
Final simplification52.1%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.7e-16) (* x y) (if (<= y 8.6e+185) (+ (* a b) (* z t)) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.7e-16) {
tmp = x * y;
} else if (y <= 8.6e+185) {
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 (y <= (-1.7d-16)) then
tmp = x * y
else if (y <= 8.6d+185) 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 (y <= -1.7e-16) {
tmp = x * y;
} else if (y <= 8.6e+185) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.7e-16: tmp = x * y elif y <= 8.6e+185: tmp = (a * b) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.7e-16) tmp = Float64(x * y); elseif (y <= 8.6e+185) 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 (y <= -1.7e-16) tmp = x * y; elseif (y <= 8.6e+185) tmp = (a * b) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.7e-16], N[(x * y), $MachinePrecision], If[LessEqual[y, 8.6e+185], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-16}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{+185}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -1.7e-16 or 8.6000000000000002e185 < y Initial program 96.0%
Taylor expanded in x around inf 63.5%
if -1.7e-16 < y < 8.6000000000000002e185Initial program 98.7%
Taylor expanded in x around 0 81.1%
Final simplification74.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 33.1%
Final simplification33.1%
herbie shell --seed 2023185
(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)))