
(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 9 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 (let* ((t_1 (+ (* a b) (+ (* z t) (* x y))))) (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) + ((z * t) + (x * y));
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) + ((z * t) + (x * y));
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) + ((z * t) + (x * y)) 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(z * t) + Float64(x * y))) 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) + ((z * t) + (x * y)); 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[(z * t), $MachinePrecision] + N[(x * y), $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(z \cdot t + x \cdot y\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 66.8%
Final simplification99.2%
(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 97.6%
associate-+l+97.6%
fma-def98.0%
fma-def98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (fma x y (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + fma(x, y, (z * t));
}
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + fma(x, y, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)
\end{array}
Initial program 97.6%
fma-def98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -5.1e+108)
(* a b)
(if (<= (* a b) -1.45e+62)
(* x y)
(if (<= (* a b) -3.4e+23)
(* a b)
(if (<= (* a b) -0.0155)
(* z t)
(if (<= (* a b) -1e-8)
(* a b)
(if (<= (* a b) -2.3e-55)
(* x y)
(if (<= (* a b) -8.6e-109)
(* z t)
(if (<= (* a b) -7.5e-246)
(* x y)
(if (<= (* a b) 4.3e+27) (* z t) (* a b)))))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -5.1e+108) {
tmp = a * b;
} else if ((a * b) <= -1.45e+62) {
tmp = x * y;
} else if ((a * b) <= -3.4e+23) {
tmp = a * b;
} else if ((a * b) <= -0.0155) {
tmp = z * t;
} else if ((a * b) <= -1e-8) {
tmp = a * b;
} else if ((a * b) <= -2.3e-55) {
tmp = x * y;
} else if ((a * b) <= -8.6e-109) {
tmp = z * t;
} else if ((a * b) <= -7.5e-246) {
tmp = x * y;
} else if ((a * b) <= 4.3e+27) {
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) <= (-5.1d+108)) then
tmp = a * b
else if ((a * b) <= (-1.45d+62)) then
tmp = x * y
else if ((a * b) <= (-3.4d+23)) then
tmp = a * b
else if ((a * b) <= (-0.0155d0)) then
tmp = z * t
else if ((a * b) <= (-1d-8)) then
tmp = a * b
else if ((a * b) <= (-2.3d-55)) then
tmp = x * y
else if ((a * b) <= (-8.6d-109)) then
tmp = z * t
else if ((a * b) <= (-7.5d-246)) then
tmp = x * y
else if ((a * b) <= 4.3d+27) 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) <= -5.1e+108) {
tmp = a * b;
} else if ((a * b) <= -1.45e+62) {
tmp = x * y;
} else if ((a * b) <= -3.4e+23) {
tmp = a * b;
} else if ((a * b) <= -0.0155) {
tmp = z * t;
} else if ((a * b) <= -1e-8) {
tmp = a * b;
} else if ((a * b) <= -2.3e-55) {
tmp = x * y;
} else if ((a * b) <= -8.6e-109) {
tmp = z * t;
} else if ((a * b) <= -7.5e-246) {
tmp = x * y;
} else if ((a * b) <= 4.3e+27) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -5.1e+108: tmp = a * b elif (a * b) <= -1.45e+62: tmp = x * y elif (a * b) <= -3.4e+23: tmp = a * b elif (a * b) <= -0.0155: tmp = z * t elif (a * b) <= -1e-8: tmp = a * b elif (a * b) <= -2.3e-55: tmp = x * y elif (a * b) <= -8.6e-109: tmp = z * t elif (a * b) <= -7.5e-246: tmp = x * y elif (a * b) <= 4.3e+27: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -5.1e+108) tmp = Float64(a * b); elseif (Float64(a * b) <= -1.45e+62) tmp = Float64(x * y); elseif (Float64(a * b) <= -3.4e+23) tmp = Float64(a * b); elseif (Float64(a * b) <= -0.0155) tmp = Float64(z * t); elseif (Float64(a * b) <= -1e-8) tmp = Float64(a * b); elseif (Float64(a * b) <= -2.3e-55) tmp = Float64(x * y); elseif (Float64(a * b) <= -8.6e-109) tmp = Float64(z * t); elseif (Float64(a * b) <= -7.5e-246) tmp = Float64(x * y); elseif (Float64(a * b) <= 4.3e+27) 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) <= -5.1e+108) tmp = a * b; elseif ((a * b) <= -1.45e+62) tmp = x * y; elseif ((a * b) <= -3.4e+23) tmp = a * b; elseif ((a * b) <= -0.0155) tmp = z * t; elseif ((a * b) <= -1e-8) tmp = a * b; elseif ((a * b) <= -2.3e-55) tmp = x * y; elseif ((a * b) <= -8.6e-109) tmp = z * t; elseif ((a * b) <= -7.5e-246) tmp = x * y; elseif ((a * b) <= 4.3e+27) 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], -5.1e+108], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.45e+62], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -3.4e+23], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -0.0155], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1e-8], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2.3e-55], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -8.6e-109], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -7.5e-246], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4.3e+27], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5.1 \cdot 10^{+108}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.45 \cdot 10^{+62}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -3.4 \cdot 10^{+23}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -0.0155:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-8}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -2.3 \cdot 10^{-55}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -8.6 \cdot 10^{-109}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -7.5 \cdot 10^{-246}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 4.3 \cdot 10^{+27}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -5.09999999999999968e108 or -1.44999999999999992e62 < (*.f64 a b) < -3.39999999999999992e23 or -0.0155 < (*.f64 a b) < -1e-8 or 4.30000000000000008e27 < (*.f64 a b) Initial program 95.8%
Taylor expanded in a around inf 64.7%
if -5.09999999999999968e108 < (*.f64 a b) < -1.44999999999999992e62 or -1e-8 < (*.f64 a b) < -2.30000000000000011e-55 or -8.5999999999999993e-109 < (*.f64 a b) < -7.50000000000000049e-246Initial program 100.0%
Taylor expanded in x around inf 68.3%
if -3.39999999999999992e23 < (*.f64 a b) < -0.0155 or -2.30000000000000011e-55 < (*.f64 a b) < -8.5999999999999993e-109 or -7.50000000000000049e-246 < (*.f64 a b) < 4.30000000000000008e27Initial program 99.0%
Taylor expanded in z around inf 61.0%
Final simplification63.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -7.2e-47)
(* x y)
(if (or (<= y 2.6e+96) (and (not (<= y 2.55e+110)) (<= y 1.9e+209)))
(+ (* a b) (* z t))
(* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7.2e-47) {
tmp = x * y;
} else if ((y <= 2.6e+96) || (!(y <= 2.55e+110) && (y <= 1.9e+209))) {
tmp = (a * b) + (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 (y <= (-7.2d-47)) then
tmp = x * y
else if ((y <= 2.6d+96) .or. (.not. (y <= 2.55d+110)) .and. (y <= 1.9d+209)) then
tmp = (a * b) + (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 (y <= -7.2e-47) {
tmp = x * y;
} else if ((y <= 2.6e+96) || (!(y <= 2.55e+110) && (y <= 1.9e+209))) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -7.2e-47: tmp = x * y elif (y <= 2.6e+96) or (not (y <= 2.55e+110) and (y <= 1.9e+209)): tmp = (a * b) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -7.2e-47) tmp = Float64(x * y); elseif ((y <= 2.6e+96) || (!(y <= 2.55e+110) && (y <= 1.9e+209))) tmp = Float64(Float64(a * b) + 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 (y <= -7.2e-47) tmp = x * y; elseif ((y <= 2.6e+96) || (~((y <= 2.55e+110)) && (y <= 1.9e+209))) tmp = (a * b) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -7.2e-47], N[(x * y), $MachinePrecision], If[Or[LessEqual[y, 2.6e+96], And[N[Not[LessEqual[y, 2.55e+110]], $MachinePrecision], LessEqual[y, 1.9e+209]]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-47}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+96} \lor \neg \left(y \leq 2.55 \cdot 10^{+110}\right) \land y \leq 1.9 \cdot 10^{+209}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -7.19999999999999982e-47 or 2.6e96 < y < 2.5500000000000001e110 or 1.89999999999999992e209 < y Initial program 98.0%
Taylor expanded in x around inf 54.6%
if -7.19999999999999982e-47 < y < 2.6e96 or 2.5500000000000001e110 < y < 1.89999999999999992e209Initial program 97.4%
Taylor expanded in x around 0 80.3%
Final simplification70.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -8.5e+23) (not (<= (* a b) 7.5e+20))) (+ (* a b) (* x y)) (+ (* z t) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -8.5e+23) || !((a * b) <= 7.5e+20)) {
tmp = (a * b) + (x * y);
} else {
tmp = (z * t) + (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 (((a * b) <= (-8.5d+23)) .or. (.not. ((a * b) <= 7.5d+20))) then
tmp = (a * b) + (x * y)
else
tmp = (z * t) + (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 (((a * b) <= -8.5e+23) || !((a * b) <= 7.5e+20)) {
tmp = (a * b) + (x * y);
} else {
tmp = (z * t) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -8.5e+23) or not ((a * b) <= 7.5e+20): tmp = (a * b) + (x * y) else: tmp = (z * t) + (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -8.5e+23) || !(Float64(a * b) <= 7.5e+20)) tmp = Float64(Float64(a * b) + Float64(x * y)); else tmp = Float64(Float64(z * t) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((a * b) <= -8.5e+23) || ~(((a * b) <= 7.5e+20))) tmp = (a * b) + (x * y); else tmp = (z * t) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -8.5e+23], N[Not[LessEqual[N[(a * b), $MachinePrecision], 7.5e+20]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.5 \cdot 10^{+23} \lor \neg \left(a \cdot b \leq 7.5 \cdot 10^{+20}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -8.5000000000000001e23 or 7.5e20 < (*.f64 a b) Initial program 96.1%
Taylor expanded in z around 0 81.6%
if -8.5000000000000001e23 < (*.f64 a b) < 7.5e20Initial program 99.2%
Taylor expanded in a around 0 92.1%
Final simplification86.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.3e-47) (not (<= y 4.3e+94))) (+ (* 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 ((y <= -4.3e-47) || !(y <= 4.3e+94)) {
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 ((y <= (-4.3d-47)) .or. (.not. (y <= 4.3d+94))) 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 ((y <= -4.3e-47) || !(y <= 4.3e+94)) {
tmp = (a * b) + (x * y);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.3e-47) or not (y <= 4.3e+94): 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 ((y <= -4.3e-47) || !(y <= 4.3e+94)) 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 ((y <= -4.3e-47) || ~((y <= 4.3e+94))) 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[y, -4.3e-47], N[Not[LessEqual[y, 4.3e+94]], $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}\;y \leq -4.3 \cdot 10^{-47} \lor \neg \left(y \leq 4.3 \cdot 10^{+94}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if y < -4.2999999999999998e-47 or 4.3e94 < y Initial program 97.5%
Taylor expanded in z around 0 79.8%
if -4.2999999999999998e-47 < y < 4.3e94Initial program 97.8%
Taylor expanded in x around 0 83.7%
Final simplification81.9%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -8.5e+23) (* a b) (if (<= (* a b) 1.4e+26) (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -8.5e+23) {
tmp = a * b;
} else if ((a * b) <= 1.4e+26) {
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) <= (-8.5d+23)) then
tmp = a * b
else if ((a * b) <= 1.4d+26) 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) <= -8.5e+23) {
tmp = a * b;
} else if ((a * b) <= 1.4e+26) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -8.5e+23: tmp = a * b elif (a * b) <= 1.4e+26: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -8.5e+23) tmp = Float64(a * b); elseif (Float64(a * b) <= 1.4e+26) 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) <= -8.5e+23) tmp = a * b; elseif ((a * b) <= 1.4e+26) 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], -8.5e+23], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.4e+26], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.5 \cdot 10^{+23}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.4 \cdot 10^{+26}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -8.5000000000000001e23 or 1.4e26 < (*.f64 a b) Initial program 96.0%
Taylor expanded in a around inf 60.6%
if -8.5000000000000001e23 < (*.f64 a b) < 1.4e26Initial program 99.2%
Taylor expanded in z around inf 53.4%
Final simplification56.9%
(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 34.5%
Final simplification34.5%
herbie shell --seed 2023171
(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)))