
(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 96.9%
+-commutative96.9%
fma-define98.0%
fma-define98.8%
Simplified98.8%
Final simplification98.8%
(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 y x (* z t)))))
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(y, x, (z * t));
}
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(y, x, Float64(z * t)); 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[(y * x + N[(z * t), $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(y, x, z \cdot t\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 a around 0 37.5%
+-commutative37.5%
*-commutative37.5%
fma-define62.5%
Applied egg-rr62.5%
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 96.9%
fma-define97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= (* x y) -3.6e+76)
(and (not (<= (* x y) -2.8e+22))
(or (<= (* x y) -1.65e-63) (not (<= (* x y) 2.35e+104)))))
(+ (* 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) <= -3.6e+76) || (!((x * y) <= -2.8e+22) && (((x * y) <= -1.65e-63) || !((x * y) <= 2.35e+104)))) {
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) <= (-3.6d+76)) .or. (.not. ((x * y) <= (-2.8d+22))) .and. ((x * y) <= (-1.65d-63)) .or. (.not. ((x * y) <= 2.35d+104))) 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) <= -3.6e+76) || (!((x * y) <= -2.8e+22) && (((x * y) <= -1.65e-63) || !((x * y) <= 2.35e+104)))) {
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) <= -3.6e+76) or (not ((x * y) <= -2.8e+22) and (((x * y) <= -1.65e-63) or not ((x * y) <= 2.35e+104))): 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) <= -3.6e+76) || (!(Float64(x * y) <= -2.8e+22) && ((Float64(x * y) <= -1.65e-63) || !(Float64(x * y) <= 2.35e+104)))) 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) <= -3.6e+76) || (~(((x * y) <= -2.8e+22)) && (((x * y) <= -1.65e-63) || ~(((x * y) <= 2.35e+104))))) 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], -3.6e+76], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], -2.8e+22]], $MachinePrecision], Or[LessEqual[N[(x * y), $MachinePrecision], -1.65e-63], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.35e+104]], $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 -3.6 \cdot 10^{+76} \lor \neg \left(x \cdot y \leq -2.8 \cdot 10^{+22}\right) \land \left(x \cdot y \leq -1.65 \cdot 10^{-63} \lor \neg \left(x \cdot y \leq 2.35 \cdot 10^{+104}\right)\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -3.6000000000000003e76 or -2.8e22 < (*.f64 x y) < -1.64999999999999997e-63 or 2.35000000000000008e104 < (*.f64 x y) Initial program 93.3%
Taylor expanded in z around 0 84.1%
if -3.6000000000000003e76 < (*.f64 x y) < -2.8e22 or -1.64999999999999997e-63 < (*.f64 x y) < 2.35000000000000008e104Initial program 99.3%
Taylor expanded in x around 0 89.7%
Final simplification87.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -6e+52)
(* a b)
(if (<= (* a b) -2.1e-179)
(* x y)
(if (<= (* a b) 1.45e-238)
(* z t)
(if (<= (* a b) 3.1e+70) (* x y) (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -6e+52) {
tmp = a * b;
} else if ((a * b) <= -2.1e-179) {
tmp = x * y;
} else if ((a * b) <= 1.45e-238) {
tmp = z * t;
} else if ((a * b) <= 3.1e+70) {
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) <= (-6d+52)) then
tmp = a * b
else if ((a * b) <= (-2.1d-179)) then
tmp = x * y
else if ((a * b) <= 1.45d-238) then
tmp = z * t
else if ((a * b) <= 3.1d+70) 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) <= -6e+52) {
tmp = a * b;
} else if ((a * b) <= -2.1e-179) {
tmp = x * y;
} else if ((a * b) <= 1.45e-238) {
tmp = z * t;
} else if ((a * b) <= 3.1e+70) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -6e+52: tmp = a * b elif (a * b) <= -2.1e-179: tmp = x * y elif (a * b) <= 1.45e-238: tmp = z * t elif (a * b) <= 3.1e+70: tmp = x * y else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -6e+52) tmp = Float64(a * b); elseif (Float64(a * b) <= -2.1e-179) tmp = Float64(x * y); elseif (Float64(a * b) <= 1.45e-238) tmp = Float64(z * t); elseif (Float64(a * b) <= 3.1e+70) 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) <= -6e+52) tmp = a * b; elseif ((a * b) <= -2.1e-179) tmp = x * y; elseif ((a * b) <= 1.45e-238) tmp = z * t; elseif ((a * b) <= 3.1e+70) 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], -6e+52], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2.1e-179], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.45e-238], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.1e+70], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6 \cdot 10^{+52}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -2.1 \cdot 10^{-179}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.45 \cdot 10^{-238}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 3.1 \cdot 10^{+70}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -6e52 or 3.1000000000000003e70 < (*.f64 a b) Initial program 95.5%
Taylor expanded in a around inf 79.4%
if -6e52 < (*.f64 a b) < -2.0999999999999999e-179 or 1.4499999999999999e-238 < (*.f64 a b) < 3.1000000000000003e70Initial program 100.0%
Taylor expanded in x around inf 51.0%
if -2.0999999999999999e-179 < (*.f64 a b) < 1.4499999999999999e-238Initial program 94.9%
Taylor expanded in z around inf 57.6%
Final simplification64.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* a b) (+ (* x y) (* z t))))) (if (<= t_1 INFINITY) t_1 (* z t))))
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 = z * t;
}
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 = z * t;
}
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 = z * t 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(z * t); 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 = z * t; 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[(z * t), $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}:\\
\;\;\;\;z \cdot t\\
\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 inf 50.4%
Final simplification98.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -7.5e+88) (not (<= (* x y) 3.5e+140))) (* 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) <= -7.5e+88) || !((x * y) <= 3.5e+140)) {
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) <= (-7.5d+88)) .or. (.not. ((x * y) <= 3.5d+140))) 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) <= -7.5e+88) || !((x * y) <= 3.5e+140)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -7.5e+88) or not ((x * y) <= 3.5e+140): 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) <= -7.5e+88) || !(Float64(x * y) <= 3.5e+140)) 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) <= -7.5e+88) || ~(((x * y) <= 3.5e+140))) 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], -7.5e+88], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3.5e+140]], $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.5 \cdot 10^{+88} \lor \neg \left(x \cdot y \leq 3.5 \cdot 10^{+140}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -7.50000000000000031e88 or 3.49999999999999989e140 < (*.f64 x y) Initial program 90.9%
Taylor expanded in x around inf 71.7%
if -7.50000000000000031e88 < (*.f64 x y) < 3.49999999999999989e140Initial program 99.4%
Taylor expanded in x around 0 85.9%
Final simplification81.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -5.4e+51) (not (<= (* a b) 8e+66))) (+ (* a b) (* z t)) (+ (* x y) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -5.4e+51) || !((a * b) <= 8e+66)) {
tmp = (a * b) + (z * t);
} 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) <= (-5.4d+51)) .or. (.not. ((a * b) <= 8d+66))) then
tmp = (a * b) + (z * t)
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) <= -5.4e+51) || !((a * b) <= 8e+66)) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -5.4e+51) or not ((a * b) <= 8e+66): tmp = (a * b) + (z * t) else: tmp = (x * y) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -5.4e+51) || !(Float64(a * b) <= 8e+66)) tmp = Float64(Float64(a * b) + Float64(z * t)); 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) <= -5.4e+51) || ~(((a * b) <= 8e+66))) tmp = (a * b) + (z * t); 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], -5.4e+51], N[Not[LessEqual[N[(a * b), $MachinePrecision], 8e+66]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $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.4 \cdot 10^{+51} \lor \neg \left(a \cdot b \leq 8 \cdot 10^{+66}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -5.39999999999999983e51 or 7.99999999999999956e66 < (*.f64 a b) Initial program 95.6%
Taylor expanded in x around 0 88.6%
if -5.39999999999999983e51 < (*.f64 a b) < 7.99999999999999956e66Initial program 97.9%
Taylor expanded in a around 0 87.0%
Final simplification87.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -2.3e+29) (not (<= (* a b) 2.4e+71))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -2.3e+29) || !((a * b) <= 2.4e+71)) {
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) <= (-2.3d+29)) .or. (.not. ((a * b) <= 2.4d+71))) 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) <= -2.3e+29) || !((a * b) <= 2.4e+71)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -2.3e+29) or not ((a * b) <= 2.4e+71): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -2.3e+29) || !(Float64(a * b) <= 2.4e+71)) 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) <= -2.3e+29) || ~(((a * b) <= 2.4e+71))) 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], -2.3e+29], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.4e+71]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.3 \cdot 10^{+29} \lor \neg \left(a \cdot b \leq 2.4 \cdot 10^{+71}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -2.3000000000000001e29 or 2.39999999999999981e71 < (*.f64 a b) Initial program 95.7%
Taylor expanded in a around inf 77.6%
if -2.3000000000000001e29 < (*.f64 a b) < 2.39999999999999981e71Initial program 97.8%
Taylor expanded in z around inf 45.7%
Final simplification60.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 96.9%
Taylor expanded in a around inf 41.7%
Final simplification41.7%
herbie shell --seed 2024039
(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)))