
(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 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 98.8%
associate-+l+98.8%
fma-define99.6%
fma-define100.0%
Simplified100.0%
(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-define98.8%
fma-define98.8%
Simplified98.8%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= (* x y) -3.1e+181)
(and (not (<= (* x y) -1.5e+126))
(or (<= (* x y) -7.2e+80) (not (<= (* x y) 3.9e+87)))))
(* 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.1e+181) || (!((x * y) <= -1.5e+126) && (((x * y) <= -7.2e+80) || !((x * y) <= 3.9e+87)))) {
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.1d+181)) .or. (.not. ((x * y) <= (-1.5d+126))) .and. ((x * y) <= (-7.2d+80)) .or. (.not. ((x * y) <= 3.9d+87))) 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.1e+181) || (!((x * y) <= -1.5e+126) && (((x * y) <= -7.2e+80) || !((x * y) <= 3.9e+87)))) {
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.1e+181) or (not ((x * y) <= -1.5e+126) and (((x * y) <= -7.2e+80) or not ((x * y) <= 3.9e+87))): 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.1e+181) || (!(Float64(x * y) <= -1.5e+126) && ((Float64(x * y) <= -7.2e+80) || !(Float64(x * y) <= 3.9e+87)))) 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.1e+181) || (~(((x * y) <= -1.5e+126)) && (((x * y) <= -7.2e+80) || ~(((x * y) <= 3.9e+87))))) 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.1e+181], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], -1.5e+126]], $MachinePrecision], Or[LessEqual[N[(x * y), $MachinePrecision], -7.2e+80], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3.9e+87]], $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.1 \cdot 10^{+181} \lor \neg \left(x \cdot y \leq -1.5 \cdot 10^{+126}\right) \land \left(x \cdot y \leq -7.2 \cdot 10^{+80} \lor \neg \left(x \cdot y \leq 3.9 \cdot 10^{+87}\right)\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -3.09999999999999989e181 or -1.5000000000000001e126 < (*.f64 x y) < -7.1999999999999999e80 or 3.9000000000000002e87 < (*.f64 x y) Initial program 95.9%
Taylor expanded in x around inf 81.8%
if -3.09999999999999989e181 < (*.f64 x y) < -1.5000000000000001e126 or -7.1999999999999999e80 < (*.f64 x y) < 3.9000000000000002e87Initial program 100.0%
Taylor expanded in x around 0 91.6%
Final simplification88.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -3e+69)
(* a b)
(if (<= (* a b) -1.35e-175)
(* z t)
(if (<= (* a b) -1e-301)
(* x y)
(if (<= (* a b) 1.52e+60) (* z t) (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -3e+69) {
tmp = a * b;
} else if ((a * b) <= -1.35e-175) {
tmp = z * t;
} else if ((a * b) <= -1e-301) {
tmp = x * y;
} else if ((a * b) <= 1.52e+60) {
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) <= (-3d+69)) then
tmp = a * b
else if ((a * b) <= (-1.35d-175)) then
tmp = z * t
else if ((a * b) <= (-1d-301)) then
tmp = x * y
else if ((a * b) <= 1.52d+60) 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) <= -3e+69) {
tmp = a * b;
} else if ((a * b) <= -1.35e-175) {
tmp = z * t;
} else if ((a * b) <= -1e-301) {
tmp = x * y;
} else if ((a * b) <= 1.52e+60) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -3e+69: tmp = a * b elif (a * b) <= -1.35e-175: tmp = z * t elif (a * b) <= -1e-301: tmp = x * y elif (a * b) <= 1.52e+60: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -3e+69) tmp = Float64(a * b); elseif (Float64(a * b) <= -1.35e-175) tmp = Float64(z * t); elseif (Float64(a * b) <= -1e-301) tmp = Float64(x * y); elseif (Float64(a * b) <= 1.52e+60) 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) <= -3e+69) tmp = a * b; elseif ((a * b) <= -1.35e-175) tmp = z * t; elseif ((a * b) <= -1e-301) tmp = x * y; elseif ((a * b) <= 1.52e+60) 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], -3e+69], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.35e-175], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1e-301], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.52e+60], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3 \cdot 10^{+69}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.35 \cdot 10^{-175}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-301}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.52 \cdot 10^{+60}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -2.99999999999999983e69 or 1.52e60 < (*.f64 a b) Initial program 97.2%
Taylor expanded in a around inf 74.0%
if -2.99999999999999983e69 < (*.f64 a b) < -1.34999999999999999e-175 or -1.00000000000000007e-301 < (*.f64 a b) < 1.52e60Initial program 100.0%
Taylor expanded in z around inf 54.7%
if -1.34999999999999999e-175 < (*.f64 a b) < -1.00000000000000007e-301Initial program 100.0%
Taylor expanded in x around inf 75.2%
Final simplification64.5%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -5e+81) (+ (* x y) (* z t)) (if (<= (* x y) 2e+87) (+ (* a b) (* z t)) (* y (+ x (/ (* z t) y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -5e+81) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 2e+87) {
tmp = (a * b) + (z * t);
} else {
tmp = y * (x + ((z * t) / 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) <= (-5d+81)) then
tmp = (x * y) + (z * t)
else if ((x * y) <= 2d+87) then
tmp = (a * b) + (z * t)
else
tmp = y * (x + ((z * t) / 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) <= -5e+81) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 2e+87) {
tmp = (a * b) + (z * t);
} else {
tmp = y * (x + ((z * t) / y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -5e+81: tmp = (x * y) + (z * t) elif (x * y) <= 2e+87: tmp = (a * b) + (z * t) else: tmp = y * (x + ((z * t) / y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -5e+81) tmp = Float64(Float64(x * y) + Float64(z * t)); elseif (Float64(x * y) <= 2e+87) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(y * Float64(x + Float64(Float64(z * t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -5e+81) tmp = (x * y) + (z * t); elseif ((x * y) <= 2e+87) tmp = (a * b) + (z * t); else tmp = y * (x + ((z * t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+81], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+87], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + N[(N[(z * t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+81}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+87}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + \frac{z \cdot t}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999998e81Initial program 96.9%
Taylor expanded in a around 0 85.1%
if -4.9999999999999998e81 < (*.f64 x y) < 1.9999999999999999e87Initial program 100.0%
Taylor expanded in x around 0 91.7%
if 1.9999999999999999e87 < (*.f64 x y) Initial program 95.7%
Taylor expanded in y around inf 95.7%
Taylor expanded in a around 0 89.9%
Final simplification90.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -7.5e+73) (not (<= (* x y) 1.1e+88))) (+ (* 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) <= -7.5e+73) || !((x * y) <= 1.1e+88)) {
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) <= (-7.5d+73)) .or. (.not. ((x * y) <= 1.1d+88))) 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) <= -7.5e+73) || !((x * y) <= 1.1e+88)) {
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) <= -7.5e+73) or not ((x * y) <= 1.1e+88): 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) <= -7.5e+73) || !(Float64(x * y) <= 1.1e+88)) 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) <= -7.5e+73) || ~(((x * y) <= 1.1e+88))) 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], -7.5e+73], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.1e+88]], $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 -7.5 \cdot 10^{+73} \lor \neg \left(x \cdot y \leq 1.1 \cdot 10^{+88}\right):\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -7.5e73 or 1.10000000000000004e88 < (*.f64 x y) Initial program 96.2%
Taylor expanded in a around 0 87.9%
if -7.5e73 < (*.f64 x y) < 1.10000000000000004e88Initial program 100.0%
Taylor expanded in x around 0 91.7%
Final simplification90.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -4.3e+73) (not (<= (* x y) 3.4e+77))) (+ (* 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) <= -4.3e+73) || !((x * y) <= 3.4e+77)) {
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) <= (-4.3d+73)) .or. (.not. ((x * y) <= 3.4d+77))) 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) <= -4.3e+73) || !((x * y) <= 3.4e+77)) {
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) <= -4.3e+73) or not ((x * y) <= 3.4e+77): 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) <= -4.3e+73) || !(Float64(x * y) <= 3.4e+77)) 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) <= -4.3e+73) || ~(((x * y) <= 3.4e+77))) 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], -4.3e+73], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3.4e+77]], $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.3 \cdot 10^{+73} \lor \neg \left(x \cdot y \leq 3.4 \cdot 10^{+77}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -4.30000000000000013e73 or 3.39999999999999997e77 < (*.f64 x y) Initial program 96.2%
Taylor expanded in z around 0 85.1%
if -4.30000000000000013e73 < (*.f64 x y) < 3.39999999999999997e77Initial program 100.0%
Taylor expanded in x around 0 91.6%
Final simplification89.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -8.5e+68) (not (<= (* a b) 1.16e+62))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -8.5e+68) || !((a * b) <= 1.16e+62)) {
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) <= (-8.5d+68)) .or. (.not. ((a * b) <= 1.16d+62))) 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) <= -8.5e+68) || !((a * b) <= 1.16e+62)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -8.5e+68) or not ((a * b) <= 1.16e+62): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -8.5e+68) || !(Float64(a * b) <= 1.16e+62)) 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) <= -8.5e+68) || ~(((a * b) <= 1.16e+62))) 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], -8.5e+68], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.16e+62]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.5 \cdot 10^{+68} \lor \neg \left(a \cdot b \leq 1.16 \cdot 10^{+62}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -8.49999999999999966e68 or 1.16e62 < (*.f64 a b) Initial program 97.2%
Taylor expanded in a around inf 74.0%
if -8.49999999999999966e68 < (*.f64 a b) < 1.16e62Initial program 100.0%
Taylor expanded in z around inf 50.0%
Final simplification59.9%
(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 39.7%
herbie shell --seed 2024108
(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)))