
(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 11 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) (+ (fma x y (* z t)) (* a b)) (* x (+ y (+ (* a (/ b x)) (* t (/ z x)))))))
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 = fma(x, y, (z * t)) + (a * b);
} else {
tmp = x * (y + ((a * (b / x)) + (t * (z / x))));
}
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(fma(x, y, Float64(z * t)) + Float64(a * b)); else tmp = Float64(x * Float64(y + Float64(Float64(a * Float64(b / x)) + Float64(t * Float64(z / x))))); 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[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * N[(y + N[(N[(a * N[(b / x), $MachinePrecision]), $MachinePrecision] + N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b + \left(x \cdot y + z \cdot t\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + \left(a \cdot \frac{b}{x} + t \cdot \frac{z}{x}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 99.9%
fma-define99.9%
Simplified99.9%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in x around inf 25.0%
associate-/l*50.0%
associate-/l*87.5%
Simplified87.5%
Final simplification99.6%
(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 96.8%
+-commutative96.8%
fma-define97.6%
fma-define98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= (* x y) -2.5e+214)
(not
(or (<= (* x y) -2.45e+125)
(and (not (<= (* x y) -5.3e+82)) (<= (* x y) 4.5e+155)))))
(* 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) <= -2.5e+214) || !(((x * y) <= -2.45e+125) || (!((x * y) <= -5.3e+82) && ((x * y) <= 4.5e+155)))) {
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) <= (-2.5d+214)) .or. (.not. ((x * y) <= (-2.45d+125)) .or. (.not. ((x * y) <= (-5.3d+82))) .and. ((x * y) <= 4.5d+155))) 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) <= -2.5e+214) || !(((x * y) <= -2.45e+125) || (!((x * y) <= -5.3e+82) && ((x * y) <= 4.5e+155)))) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -2.5e+214) or not (((x * y) <= -2.45e+125) or (not ((x * y) <= -5.3e+82) and ((x * y) <= 4.5e+155))): 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) <= -2.5e+214) || !((Float64(x * y) <= -2.45e+125) || (!(Float64(x * y) <= -5.3e+82) && (Float64(x * y) <= 4.5e+155)))) 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) <= -2.5e+214) || ~((((x * y) <= -2.45e+125) || (~(((x * y) <= -5.3e+82)) && ((x * y) <= 4.5e+155))))) 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], -2.5e+214], N[Not[Or[LessEqual[N[(x * y), $MachinePrecision], -2.45e+125], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], -5.3e+82]], $MachinePrecision], LessEqual[N[(x * y), $MachinePrecision], 4.5e+155]]]], $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 -2.5 \cdot 10^{+214} \lor \neg \left(x \cdot y \leq -2.45 \cdot 10^{+125} \lor \neg \left(x \cdot y \leq -5.3 \cdot 10^{+82}\right) \land x \cdot y \leq 4.5 \cdot 10^{+155}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -2.49999999999999977e214 or -2.45000000000000008e125 < (*.f64 x y) < -5.29999999999999977e82 or 4.49999999999999973e155 < (*.f64 x y) Initial program 92.4%
Taylor expanded in x around inf 79.4%
if -2.49999999999999977e214 < (*.f64 x y) < -2.45000000000000008e125 or -5.29999999999999977e82 < (*.f64 x y) < 4.49999999999999973e155Initial program 98.8%
Taylor expanded in x around 0 79.2%
Final simplification79.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 (* x (+ y (+ (* a (/ b x)) (* t (/ z x))))))))
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 = x * (y + ((a * (b / x)) + (t * (z / x))));
}
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 = x * (y + ((a * (b / x)) + (t * (z / x))));
}
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 = x * (y + ((a * (b / x)) + (t * (z / x)))) 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(x * Float64(y + Float64(Float64(a * Float64(b / x)) + Float64(t * Float64(z / x))))); 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 = x * (y + ((a * (b / x)) + (t * (z / x)))); 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[(x * N[(y + N[(N[(a * N[(b / x), $MachinePrecision]), $MachinePrecision] + N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $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}:\\
\;\;\;\;x \cdot \left(y + \left(a \cdot \frac{b}{x} + t \cdot \frac{z}{x}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in x around inf 25.0%
associate-/l*50.0%
associate-/l*87.5%
Simplified87.5%
Final simplification99.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* a b) (+ (* x y) (* z t))))) (if (<= t_1 INFINITY) t_1 (* b (+ a (/ (* x y) b))))))
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 = b * (a + ((x * y) / b));
}
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 = b * (a + ((x * y) / b));
}
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 = b * (a + ((x * y) / b)) 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(b * Float64(a + Float64(Float64(x * y) / b))); 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 = b * (a + ((x * y) / b)); 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[(b * N[(a + N[(N[(x * y), $MachinePrecision] / b), $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}:\\
\;\;\;\;b \cdot \left(a + \frac{x \cdot y}{b}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in z around 0 50.0%
Taylor expanded in b around inf 75.0%
Final simplification99.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -2.9e+104)
(* a b)
(if (<= (* a b) 1.25e-88)
(* x y)
(if (<= (* a b) 1.8e+101) (* z t) (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2.9e+104) {
tmp = a * b;
} else if ((a * b) <= 1.25e-88) {
tmp = x * y;
} else if ((a * b) <= 1.8e+101) {
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) <= (-2.9d+104)) then
tmp = a * b
else if ((a * b) <= 1.25d-88) then
tmp = x * y
else if ((a * b) <= 1.8d+101) 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) <= -2.9e+104) {
tmp = a * b;
} else if ((a * b) <= 1.25e-88) {
tmp = x * y;
} else if ((a * b) <= 1.8e+101) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -2.9e+104: tmp = a * b elif (a * b) <= 1.25e-88: tmp = x * y elif (a * b) <= 1.8e+101: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -2.9e+104) tmp = Float64(a * b); elseif (Float64(a * b) <= 1.25e-88) tmp = Float64(x * y); elseif (Float64(a * b) <= 1.8e+101) 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) <= -2.9e+104) tmp = a * b; elseif ((a * b) <= 1.25e-88) tmp = x * y; elseif ((a * b) <= 1.8e+101) 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], -2.9e+104], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.25e-88], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.8e+101], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.9 \cdot 10^{+104}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.25 \cdot 10^{-88}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.8 \cdot 10^{+101}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -2.8999999999999998e104 or 1.80000000000000015e101 < (*.f64 a b) Initial program 92.2%
Taylor expanded in a around inf 74.7%
if -2.8999999999999998e104 < (*.f64 a b) < 1.25000000000000002e-88Initial program 99.2%
Taylor expanded in x around inf 52.4%
if 1.25000000000000002e-88 < (*.f64 a b) < 1.80000000000000015e101Initial program 97.5%
Taylor expanded in z around inf 58.2%
Final simplification60.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -4e+74) (not (<= (* a b) 2e+101))) (* b (+ a (/ (* x y) b))) (+ (* x y) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -4e+74) || !((a * b) <= 2e+101)) {
tmp = b * (a + ((x * y) / b));
} 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 (((a * b) <= (-4d+74)) .or. (.not. ((a * b) <= 2d+101))) then
tmp = b * (a + ((x * y) / b))
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 (((a * b) <= -4e+74) || !((a * b) <= 2e+101)) {
tmp = b * (a + ((x * y) / b));
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -4e+74) or not ((a * b) <= 2e+101): tmp = b * (a + ((x * y) / b)) else: tmp = (x * y) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -4e+74) || !(Float64(a * b) <= 2e+101)) tmp = Float64(b * Float64(a + Float64(Float64(x * y) / b))); 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 (((a * b) <= -4e+74) || ~(((a * b) <= 2e+101))) tmp = b * (a + ((x * y) / b)); else tmp = (x * y) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -4e+74], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+101]], $MachinePrecision]], N[(b * N[(a + N[(N[(x * y), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+74} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+101}\right):\\
\;\;\;\;b \cdot \left(a + \frac{x \cdot y}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -3.99999999999999981e74 or 2e101 < (*.f64 a b) Initial program 92.9%
Taylor expanded in z around 0 86.6%
Taylor expanded in b around inf 89.0%
if -3.99999999999999981e74 < (*.f64 a b) < 2e101Initial program 98.8%
Taylor expanded in a around 0 87.8%
Final simplification88.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -550000000.0) (not (<= (* x y) 1.3e-6))) (+ (* 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) <= -550000000.0) || !((x * y) <= 1.3e-6)) {
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) <= (-550000000.0d0)) .or. (.not. ((x * y) <= 1.3d-6))) 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) <= -550000000.0) || !((x * y) <= 1.3e-6)) {
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) <= -550000000.0) or not ((x * y) <= 1.3e-6): 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) <= -550000000.0) || !(Float64(x * y) <= 1.3e-6)) 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) <= -550000000.0) || ~(((x * y) <= 1.3e-6))) 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], -550000000.0], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.3e-6]], $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 -550000000 \lor \neg \left(x \cdot y \leq 1.3 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -5.5e8 or 1.30000000000000005e-6 < (*.f64 x y) Initial program 95.2%
Taylor expanded in z around 0 80.3%
if -5.5e8 < (*.f64 x y) < 1.30000000000000005e-6Initial program 98.4%
Taylor expanded in x around 0 85.2%
Final simplification82.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -5e+71) (not (<= (* a b) 2.1e+101))) (+ (* x y) (* a b)) (+ (* x y) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -5e+71) || !((a * b) <= 2.1e+101)) {
tmp = (x * y) + (a * b);
} 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 (((a * b) <= (-5d+71)) .or. (.not. ((a * b) <= 2.1d+101))) then
tmp = (x * y) + (a * b)
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 (((a * b) <= -5e+71) || !((a * b) <= 2.1e+101)) {
tmp = (x * y) + (a * b);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -5e+71) or not ((a * b) <= 2.1e+101): tmp = (x * y) + (a * b) else: tmp = (x * y) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -5e+71) || !(Float64(a * b) <= 2.1e+101)) tmp = Float64(Float64(x * y) + Float64(a * b)); 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 (((a * b) <= -5e+71) || ~(((a * b) <= 2.1e+101))) tmp = (x * y) + (a * b); else tmp = (x * y) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -5e+71], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.1e+101]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+71} \lor \neg \left(a \cdot b \leq 2.1 \cdot 10^{+101}\right):\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -4.99999999999999972e71 or 2.1e101 < (*.f64 a b) Initial program 92.9%
Taylor expanded in z around 0 86.6%
if -4.99999999999999972e71 < (*.f64 a b) < 2.1e101Initial program 98.8%
Taylor expanded in a around 0 87.8%
Final simplification87.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -4.2e+75) (not (<= (* a b) 1.65e+101))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -4.2e+75) || !((a * b) <= 1.65e+101)) {
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) <= (-4.2d+75)) .or. (.not. ((a * b) <= 1.65d+101))) 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) <= -4.2e+75) || !((a * b) <= 1.65e+101)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -4.2e+75) or not ((a * b) <= 1.65e+101): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -4.2e+75) || !(Float64(a * b) <= 1.65e+101)) 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) <= -4.2e+75) || ~(((a * b) <= 1.65e+101))) 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], -4.2e+75], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.65e+101]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.2 \cdot 10^{+75} \lor \neg \left(a \cdot b \leq 1.65 \cdot 10^{+101}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -4.19999999999999997e75 or 1.65000000000000006e101 < (*.f64 a b) Initial program 92.9%
Taylor expanded in a around inf 70.3%
if -4.19999999999999997e75 < (*.f64 a b) < 1.65000000000000006e101Initial program 98.8%
Taylor expanded in z around inf 44.0%
Final simplification52.7%
(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 96.8%
Taylor expanded in a around inf 32.0%
Final simplification32.0%
herbie shell --seed 2024067
(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)))