
(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 97.6%
+-commutative97.6%
fma-define98.4%
fma-define98.8%
Simplified98.8%
Final simplification98.8%
(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 97.6%
fma-define98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -1.1e+77)
(* x y)
(if (<= (* x y) 5.8e-180)
(* z t)
(if (<= (* x y) 2.6e-115)
(* a b)
(if (<= (* x y) 1.35e+129) (* z t) (* x y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -1.1e+77) {
tmp = x * y;
} else if ((x * y) <= 5.8e-180) {
tmp = z * t;
} else if ((x * y) <= 2.6e-115) {
tmp = a * b;
} else if ((x * y) <= 1.35e+129) {
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.1d+77)) then
tmp = x * y
else if ((x * y) <= 5.8d-180) then
tmp = z * t
else if ((x * y) <= 2.6d-115) then
tmp = a * b
else if ((x * y) <= 1.35d+129) 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.1e+77) {
tmp = x * y;
} else if ((x * y) <= 5.8e-180) {
tmp = z * t;
} else if ((x * y) <= 2.6e-115) {
tmp = a * b;
} else if ((x * y) <= 1.35e+129) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -1.1e+77: tmp = x * y elif (x * y) <= 5.8e-180: tmp = z * t elif (x * y) <= 2.6e-115: tmp = a * b elif (x * y) <= 1.35e+129: 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.1e+77) tmp = Float64(x * y); elseif (Float64(x * y) <= 5.8e-180) tmp = Float64(z * t); elseif (Float64(x * y) <= 2.6e-115) tmp = Float64(a * b); elseif (Float64(x * y) <= 1.35e+129) 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.1e+77) tmp = x * y; elseif ((x * y) <= 5.8e-180) tmp = z * t; elseif ((x * y) <= 2.6e-115) tmp = a * b; elseif ((x * y) <= 1.35e+129) 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.1e+77], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5.8e-180], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.6e-115], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.35e+129], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.1 \cdot 10^{+77}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 5.8 \cdot 10^{-180}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{-115}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 1.35 \cdot 10^{+129}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -1.1e77 or 1.35e129 < (*.f64 x y) Initial program 94.2%
Taylor expanded in x around inf 77.3%
if -1.1e77 < (*.f64 x y) < 5.79999999999999961e-180 or 2.60000000000000004e-115 < (*.f64 x y) < 1.35e129Initial program 99.4%
Taylor expanded in z around inf 53.0%
if 5.79999999999999961e-180 < (*.f64 x y) < 2.60000000000000004e-115Initial program 99.8%
Taylor expanded in a around inf 87.4%
Final simplification62.4%
(FPCore (x y z t a b) :precision binary64 (if (<= (* z t) -1e+17) (+ (* a b) (* z t)) (if (<= (* z t) 1e+37) (+ (* a b) (* x y)) (* z (+ t (/ (* x y) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z * t) <= -1e+17) {
tmp = (a * b) + (z * t);
} else if ((z * t) <= 1e+37) {
tmp = (a * b) + (x * y);
} else {
tmp = z * (t + ((x * y) / z));
}
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 * t) <= (-1d+17)) then
tmp = (a * b) + (z * t)
else if ((z * t) <= 1d+37) then
tmp = (a * b) + (x * y)
else
tmp = z * (t + ((x * y) / z))
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 * t) <= -1e+17) {
tmp = (a * b) + (z * t);
} else if ((z * t) <= 1e+37) {
tmp = (a * b) + (x * y);
} else {
tmp = z * (t + ((x * y) / z));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z * t) <= -1e+17: tmp = (a * b) + (z * t) elif (z * t) <= 1e+37: tmp = (a * b) + (x * y) else: tmp = z * (t + ((x * y) / z)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(z * t) <= -1e+17) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (Float64(z * t) <= 1e+37) tmp = Float64(Float64(a * b) + Float64(x * y)); else tmp = Float64(z * Float64(t + Float64(Float64(x * y) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z * t) <= -1e+17) tmp = (a * b) + (z * t); elseif ((z * t) <= 1e+37) tmp = (a * b) + (x * y); else tmp = z * (t + ((x * y) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+17], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+37], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(z * N[(t + N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+17}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 10^{+37}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t + \frac{x \cdot y}{z}\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -1e17Initial program 95.8%
Taylor expanded in x around 0 84.8%
if -1e17 < (*.f64 z t) < 9.99999999999999954e36Initial program 98.5%
Taylor expanded in z around 0 88.4%
if 9.99999999999999954e36 < (*.f64 z t) Initial program 98.0%
Taylor expanded in z around inf 98.1%
Taylor expanded in a around 0 91.3%
Final simplification88.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -7e+84) (not (<= (* x y) 2.1e+131))) (* 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) <= -7e+84) || !((x * y) <= 2.1e+131)) {
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) <= (-7d+84)) .or. (.not. ((x * y) <= 2.1d+131))) 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) <= -7e+84) || !((x * y) <= 2.1e+131)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -7e+84) or not ((x * y) <= 2.1e+131): 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) <= -7e+84) || !(Float64(x * y) <= 2.1e+131)) 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) <= -7e+84) || ~(((x * y) <= 2.1e+131))) 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], -7e+84], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.1e+131]], $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 -7 \cdot 10^{+84} \lor \neg \left(x \cdot y \leq 2.1 \cdot 10^{+131}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -6.9999999999999998e84 or 2.09999999999999985e131 < (*.f64 x y) Initial program 94.2%
Taylor expanded in x around inf 78.2%
if -6.9999999999999998e84 < (*.f64 x y) < 2.09999999999999985e131Initial program 99.4%
Taylor expanded in x around 0 87.6%
Final simplification84.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -4e+75) (not (<= (* x y) 1.35e+129))) (+ (* a b) (* 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) <= -4e+75) || !((x * y) <= 1.35e+129)) {
tmp = (a * b) + (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) <= (-4d+75)) .or. (.not. ((x * y) <= 1.35d+129))) then
tmp = (a * b) + (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) <= -4e+75) || !((x * y) <= 1.35e+129)) {
tmp = (a * b) + (x * y);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -4e+75) or not ((x * y) <= 1.35e+129): tmp = (a * b) + (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) <= -4e+75) || !(Float64(x * y) <= 1.35e+129)) tmp = Float64(Float64(a * b) + 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) <= -4e+75) || ~(((x * y) <= 1.35e+129))) tmp = (a * b) + (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], -4e+75], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.35e+129]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+75} \lor \neg \left(x \cdot y \leq 1.35 \cdot 10^{+129}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999971e75 or 1.35e129 < (*.f64 x y) Initial program 94.2%
Taylor expanded in z around 0 88.3%
if -3.99999999999999971e75 < (*.f64 x y) < 1.35e129Initial program 99.4%
Taylor expanded in x around 0 87.5%
Final simplification87.8%
(FPCore (x y z t a b) :precision binary64 (if (<= (* z t) -1e+17) (+ (* a b) (* z t)) (if (<= (* z t) 2e+27) (+ (* a b) (* x y)) (+ (* x y) (* z t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z * t) <= -1e+17) {
tmp = (a * b) + (z * t);
} else if ((z * t) <= 2e+27) {
tmp = (a * b) + (x * y);
} 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 ((z * t) <= (-1d+17)) then
tmp = (a * b) + (z * t)
else if ((z * t) <= 2d+27) then
tmp = (a * b) + (x * y)
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 ((z * t) <= -1e+17) {
tmp = (a * b) + (z * t);
} else if ((z * t) <= 2e+27) {
tmp = (a * b) + (x * y);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z * t) <= -1e+17: tmp = (a * b) + (z * t) elif (z * t) <= 2e+27: tmp = (a * b) + (x * y) else: tmp = (x * y) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(z * t) <= -1e+17) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (Float64(z * t) <= 2e+27) tmp = Float64(Float64(a * b) + Float64(x * y)); 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 ((z * t) <= -1e+17) tmp = (a * b) + (z * t); elseif ((z * t) <= 2e+27) tmp = (a * b) + (x * y); else tmp = (x * y) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+17], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+27], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+17}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+27}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -1e17Initial program 95.8%
Taylor expanded in x around 0 84.8%
if -1e17 < (*.f64 z t) < 2e27Initial program 98.5%
Taylor expanded in z around 0 88.3%
if 2e27 < (*.f64 z t) Initial program 98.1%
Taylor expanded in a around 0 89.8%
Final simplification87.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -1.7e+231) (not (<= (* a b) 2.25e+106))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -1.7e+231) || !((a * b) <= 2.25e+106)) {
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) <= (-1.7d+231)) .or. (.not. ((a * b) <= 2.25d+106))) 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) <= -1.7e+231) || !((a * b) <= 2.25e+106)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -1.7e+231) or not ((a * b) <= 2.25e+106): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -1.7e+231) || !(Float64(a * b) <= 2.25e+106)) 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) <= -1.7e+231) || ~(((a * b) <= 2.25e+106))) 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], -1.7e+231], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.25e+106]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.7 \cdot 10^{+231} \lor \neg \left(a \cdot b \leq 2.25 \cdot 10^{+106}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -1.7e231 or 2.2499999999999998e106 < (*.f64 a b) Initial program 94.1%
Taylor expanded in a around inf 78.2%
if -1.7e231 < (*.f64 a b) < 2.2499999999999998e106Initial program 98.9%
Taylor expanded in z around inf 45.2%
Final simplification54.0%
(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 97.6%
Final simplification97.6%
(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.8%
Final simplification33.8%
herbie shell --seed 2024059
(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)))