
(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))) (* x (+ y (+ (* t (/ z x)) (* a (/ b 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 = (a * b) + fma(x, y, (z * t));
} else {
tmp = x * (y + ((t * (z / x)) + (a * (b / 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(Float64(a * b) + fma(x, y, Float64(z * t))); else tmp = Float64(x * Float64(y + Float64(Float64(t * Float64(z / x)) + Float64(a * Float64(b / 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[(a * b), $MachinePrecision] + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y + N[(N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b / 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:\\
\;\;\;\;a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + \left(t \cdot \frac{z}{x} + a \cdot \frac{b}{x}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
fma-define100.0%
Simplified100.0%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
fma-define25.0%
Simplified25.0%
Taylor expanded in x around inf 50.0%
+-commutative50.0%
associate-/l*62.5%
associate-/l*87.5%
Simplified87.5%
Final simplification99.6%
(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 96.8%
associate-+l+96.8%
fma-define98.4%
fma-define99.2%
Simplified99.2%
(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%
(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 (+ (* t (/ z x)) (* a (/ b 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 + ((t * (z / x)) + (a * (b / 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 + ((t * (z / x)) + (a * (b / 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 + ((t * (z / x)) + (a * (b / 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(t * Float64(z / x)) + Float64(a * Float64(b / 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 + ((t * (z / x)) + (a * (b / 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[(t * N[(z / x), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b / 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(t \cdot \frac{z}{x} + a \cdot \frac{b}{x}\right)\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%
fma-define25.0%
Simplified25.0%
Taylor expanded in x around inf 50.0%
+-commutative50.0%
associate-/l*62.5%
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 (* a (+ b (* t (/ z a)))))))
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 + (t * (z / a)));
}
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 + (t * (z / a)));
}
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 + (t * (z / a))) 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(a * Float64(b + Float64(t * Float64(z / a)))); 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 + (t * (z / a))); 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[(a * N[(b + N[(t * N[(z / a), $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}:\\
\;\;\;\;a \cdot \left(b + t \cdot \frac{z}{a}\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%
fma-define25.0%
Simplified25.0%
Taylor expanded in x around 0 50.0%
Taylor expanded in a around inf 50.0%
associate-/l*75.0%
Simplified75.0%
Final simplification99.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -3.1e-87)
(* z t)
(if (<= t -7.2e-213)
(* a b)
(if (<= t 1.95e-167) (* x y) (if (<= t 3.3e+40) (* a b) (* z t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.1e-87) {
tmp = z * t;
} else if (t <= -7.2e-213) {
tmp = a * b;
} else if (t <= 1.95e-167) {
tmp = x * y;
} else if (t <= 3.3e+40) {
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 (t <= (-3.1d-87)) then
tmp = z * t
else if (t <= (-7.2d-213)) then
tmp = a * b
else if (t <= 1.95d-167) then
tmp = x * y
else if (t <= 3.3d+40) 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 (t <= -3.1e-87) {
tmp = z * t;
} else if (t <= -7.2e-213) {
tmp = a * b;
} else if (t <= 1.95e-167) {
tmp = x * y;
} else if (t <= 3.3e+40) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -3.1e-87: tmp = z * t elif t <= -7.2e-213: tmp = a * b elif t <= 1.95e-167: tmp = x * y elif t <= 3.3e+40: tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.1e-87) tmp = Float64(z * t); elseif (t <= -7.2e-213) tmp = Float64(a * b); elseif (t <= 1.95e-167) tmp = Float64(x * y); elseif (t <= 3.3e+40) 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 (t <= -3.1e-87) tmp = z * t; elseif (t <= -7.2e-213) tmp = a * b; elseif (t <= 1.95e-167) tmp = x * y; elseif (t <= 3.3e+40) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.1e-87], N[(z * t), $MachinePrecision], If[LessEqual[t, -7.2e-213], N[(a * b), $MachinePrecision], If[LessEqual[t, 1.95e-167], N[(x * y), $MachinePrecision], If[LessEqual[t, 3.3e+40], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{-87}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;t \leq -7.2 \cdot 10^{-213}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-167}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{+40}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if t < -3.09999999999999998e-87 or 3.2999999999999998e40 < t Initial program 96.5%
fma-define97.9%
Simplified97.9%
Taylor expanded in x around 0 79.3%
Taylor expanded in a around inf 69.0%
associate-/l*69.0%
Simplified69.0%
Taylor expanded in a around 0 57.7%
if -3.09999999999999998e-87 < t < -7.2000000000000002e-213 or 1.94999999999999992e-167 < t < 3.2999999999999998e40Initial program 95.9%
fma-define95.9%
Simplified95.9%
Taylor expanded in a around inf 43.4%
if -7.2000000000000002e-213 < t < 1.94999999999999992e-167Initial program 100.0%
Taylor expanded in x around inf 94.6%
Taylor expanded in a around inf 84.8%
associate-/l*82.1%
Simplified82.1%
Taylor expanded in a around 0 56.6%
Final simplification53.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -1.36e+70) (not (<= (* x y) 4.7e+172))) (* 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) <= -1.36e+70) || !((x * y) <= 4.7e+172)) {
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) <= (-1.36d+70)) .or. (.not. ((x * y) <= 4.7d+172))) 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) <= -1.36e+70) || !((x * y) <= 4.7e+172)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -1.36e+70) or not ((x * y) <= 4.7e+172): 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) <= -1.36e+70) || !(Float64(x * y) <= 4.7e+172)) 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) <= -1.36e+70) || ~(((x * y) <= 4.7e+172))) 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], -1.36e+70], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4.7e+172]], $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 -1.36 \cdot 10^{+70} \lor \neg \left(x \cdot y \leq 4.7 \cdot 10^{+172}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -1.35999999999999995e70 or 4.7000000000000001e172 < (*.f64 x y) Initial program 91.1%
Taylor expanded in x around inf 78.9%
Taylor expanded in a around inf 63.6%
associate-/l*66.0%
Simplified66.0%
Taylor expanded in a around 0 74.1%
if -1.35999999999999995e70 < (*.f64 x y) < 4.7000000000000001e172Initial program 99.4%
fma-define99.4%
Simplified99.4%
Taylor expanded in x around 0 88.9%
Final simplification84.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.5e-185) (not (<= t 5.5e+40))) (+ (* 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 ((t <= -1.5e-185) || !(t <= 5.5e+40)) {
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 ((t <= (-1.5d-185)) .or. (.not. (t <= 5.5d+40))) 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 ((t <= -1.5e-185) || !(t <= 5.5e+40)) {
tmp = (a * b) + (z * t);
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.5e-185) or not (t <= 5.5e+40): 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 ((t <= -1.5e-185) || !(t <= 5.5e+40)) 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 ((t <= -1.5e-185) || ~((t <= 5.5e+40))) 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[t, -1.5e-185], N[Not[LessEqual[t, 5.5e+40]], $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}\;t \leq -1.5 \cdot 10^{-185} \lor \neg \left(t \leq 5.5 \cdot 10^{+40}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\end{array}
if t < -1.50000000000000015e-185 or 5.49999999999999974e40 < t Initial program 96.2%
fma-define97.5%
Simplified97.5%
Taylor expanded in x around 0 77.2%
if -1.50000000000000015e-185 < t < 5.49999999999999974e40Initial program 97.9%
Taylor expanded in x around inf 81.4%
Final simplification78.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.3e-91) (not (<= t 3.4e+40))) (* z t) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.3e-91) || !(t <= 3.4e+40)) {
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 ((t <= (-1.3d-91)) .or. (.not. (t <= 3.4d+40))) 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 ((t <= -1.3e-91) || !(t <= 3.4e+40)) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.3e-91) or not (t <= 3.4e+40): tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.3e-91) || !(t <= 3.4e+40)) 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 ((t <= -1.3e-91) || ~((t <= 3.4e+40))) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.3e-91], N[Not[LessEqual[t, 3.4e+40]], $MachinePrecision]], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{-91} \lor \neg \left(t \leq 3.4 \cdot 10^{+40}\right):\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if t < -1.30000000000000007e-91 or 3.39999999999999989e40 < t Initial program 96.5%
fma-define97.9%
Simplified97.9%
Taylor expanded in x around 0 79.3%
Taylor expanded in a around inf 69.0%
associate-/l*69.0%
Simplified69.0%
Taylor expanded in a around 0 57.7%
if -1.30000000000000007e-91 < t < 3.39999999999999989e40Initial program 97.3%
fma-define97.3%
Simplified97.3%
Taylor expanded in a around inf 44.2%
Final simplification51.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 96.8%
fma-define97.6%
Simplified97.6%
Taylor expanded in a around inf 34.0%
herbie shell --seed 2024130
(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)))