
(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 8 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 z t (* a b)) (* x y)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(z, t, (a * b)) + (x * y);
}
function code(x, y, z, t, a, b) return Float64(fma(z, t, Float64(a * b)) + Float64(x * y)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, t, a \cdot b\right) + x \cdot y
\end{array}
Initial program 98.8%
associate-+l+98.8%
fma-def98.8%
fma-def99.2%
Simplified99.2%
fma-udef99.2%
+-commutative99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= x -6.5e+262)
(* x y)
(if (or (<= x -4.6e+258)
(and (not (<= x -1.56e+205))
(or (<= x -1.6e+132)
(and (not (<= x -3.6e+77)) (<= x 4150000000000.0)))))
(+ (* a b) (* z t))
(* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -6.5e+262) {
tmp = x * y;
} else if ((x <= -4.6e+258) || (!(x <= -1.56e+205) && ((x <= -1.6e+132) || (!(x <= -3.6e+77) && (x <= 4150000000000.0))))) {
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 (x <= (-6.5d+262)) then
tmp = x * y
else if ((x <= (-4.6d+258)) .or. (.not. (x <= (-1.56d+205))) .and. (x <= (-1.6d+132)) .or. (.not. (x <= (-3.6d+77))) .and. (x <= 4150000000000.0d0)) 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 (x <= -6.5e+262) {
tmp = x * y;
} else if ((x <= -4.6e+258) || (!(x <= -1.56e+205) && ((x <= -1.6e+132) || (!(x <= -3.6e+77) && (x <= 4150000000000.0))))) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -6.5e+262: tmp = x * y elif (x <= -4.6e+258) or (not (x <= -1.56e+205) and ((x <= -1.6e+132) or (not (x <= -3.6e+77) and (x <= 4150000000000.0)))): tmp = (a * b) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -6.5e+262) tmp = Float64(x * y); elseif ((x <= -4.6e+258) || (!(x <= -1.56e+205) && ((x <= -1.6e+132) || (!(x <= -3.6e+77) && (x <= 4150000000000.0))))) 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 (x <= -6.5e+262) tmp = x * y; elseif ((x <= -4.6e+258) || (~((x <= -1.56e+205)) && ((x <= -1.6e+132) || (~((x <= -3.6e+77)) && (x <= 4150000000000.0))))) tmp = (a * b) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -6.5e+262], N[(x * y), $MachinePrecision], If[Or[LessEqual[x, -4.6e+258], And[N[Not[LessEqual[x, -1.56e+205]], $MachinePrecision], Or[LessEqual[x, -1.6e+132], And[N[Not[LessEqual[x, -3.6e+77]], $MachinePrecision], LessEqual[x, 4150000000000.0]]]]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+262}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -4.6 \cdot 10^{+258} \lor \neg \left(x \leq -1.56 \cdot 10^{+205}\right) \land \left(x \leq -1.6 \cdot 10^{+132} \lor \neg \left(x \leq -3.6 \cdot 10^{+77}\right) \land x \leq 4150000000000\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -6.5000000000000005e262 or -4.6000000000000002e258 < x < -1.56000000000000007e205 or -1.5999999999999999e132 < x < -3.5999999999999998e77 or 4.15e12 < x Initial program 100.0%
Taylor expanded in x around inf 63.5%
if -6.5000000000000005e262 < x < -4.6000000000000002e258 or -1.56000000000000007e205 < x < -1.5999999999999999e132 or -3.5999999999999998e77 < x < 4.15e12Initial program 98.2%
Taylor expanded in x around 0 82.6%
Final simplification76.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.5e-78)
(* a b)
(if (<= b 1.8e-191)
(* z t)
(if (<= b 5.2e-136)
(* x y)
(if (<= b 1.15e-82)
(* z t)
(if (<= b 1.52e+26)
(* x y)
(if (<= b 2.85e+78)
(* z t)
(if (<= b 3.3e+118) (* x y) (* a b)))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.5e-78) {
tmp = a * b;
} else if (b <= 1.8e-191) {
tmp = z * t;
} else if (b <= 5.2e-136) {
tmp = x * y;
} else if (b <= 1.15e-82) {
tmp = z * t;
} else if (b <= 1.52e+26) {
tmp = x * y;
} else if (b <= 2.85e+78) {
tmp = z * t;
} else if (b <= 3.3e+118) {
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 (b <= (-1.5d-78)) then
tmp = a * b
else if (b <= 1.8d-191) then
tmp = z * t
else if (b <= 5.2d-136) then
tmp = x * y
else if (b <= 1.15d-82) then
tmp = z * t
else if (b <= 1.52d+26) then
tmp = x * y
else if (b <= 2.85d+78) then
tmp = z * t
else if (b <= 3.3d+118) 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 (b <= -1.5e-78) {
tmp = a * b;
} else if (b <= 1.8e-191) {
tmp = z * t;
} else if (b <= 5.2e-136) {
tmp = x * y;
} else if (b <= 1.15e-82) {
tmp = z * t;
} else if (b <= 1.52e+26) {
tmp = x * y;
} else if (b <= 2.85e+78) {
tmp = z * t;
} else if (b <= 3.3e+118) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -1.5e-78: tmp = a * b elif b <= 1.8e-191: tmp = z * t elif b <= 5.2e-136: tmp = x * y elif b <= 1.15e-82: tmp = z * t elif b <= 1.52e+26: tmp = x * y elif b <= 2.85e+78: tmp = z * t elif b <= 3.3e+118: tmp = x * y else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.5e-78) tmp = Float64(a * b); elseif (b <= 1.8e-191) tmp = Float64(z * t); elseif (b <= 5.2e-136) tmp = Float64(x * y); elseif (b <= 1.15e-82) tmp = Float64(z * t); elseif (b <= 1.52e+26) tmp = Float64(x * y); elseif (b <= 2.85e+78) tmp = Float64(z * t); elseif (b <= 3.3e+118) 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 (b <= -1.5e-78) tmp = a * b; elseif (b <= 1.8e-191) tmp = z * t; elseif (b <= 5.2e-136) tmp = x * y; elseif (b <= 1.15e-82) tmp = z * t; elseif (b <= 1.52e+26) tmp = x * y; elseif (b <= 2.85e+78) tmp = z * t; elseif (b <= 3.3e+118) tmp = x * y; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.5e-78], N[(a * b), $MachinePrecision], If[LessEqual[b, 1.8e-191], N[(z * t), $MachinePrecision], If[LessEqual[b, 5.2e-136], N[(x * y), $MachinePrecision], If[LessEqual[b, 1.15e-82], N[(z * t), $MachinePrecision], If[LessEqual[b, 1.52e+26], N[(x * y), $MachinePrecision], If[LessEqual[b, 2.85e+78], N[(z * t), $MachinePrecision], If[LessEqual[b, 3.3e+118], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.5 \cdot 10^{-78}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{-191}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;b \leq 5.2 \cdot 10^{-136}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{-82}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;b \leq 1.52 \cdot 10^{+26}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;b \leq 2.85 \cdot 10^{+78}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;b \leq 3.3 \cdot 10^{+118}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if b < -1.49999999999999994e-78 or 3.3e118 < b Initial program 97.1%
Taylor expanded in a around inf 53.7%
if -1.49999999999999994e-78 < b < 1.8000000000000001e-191 or 5.19999999999999993e-136 < b < 1.14999999999999998e-82 or 1.52e26 < b < 2.84999999999999993e78Initial program 100.0%
Taylor expanded in z around inf 48.8%
if 1.8000000000000001e-191 < b < 5.19999999999999993e-136 or 1.14999999999999998e-82 < b < 1.52e26 or 2.84999999999999993e78 < b < 3.3e118Initial program 100.0%
Taylor expanded in x around inf 57.1%
Final simplification52.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))))
(if (<= z -1.1e+87)
t_1
(if (<= z -8.5e+80)
(* x y)
(if (or (<= z -1.55e+19) (not (<= z 1.3e-121)))
t_1
(+ (* a b) (* x y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + (z * t);
double tmp;
if (z <= -1.1e+87) {
tmp = t_1;
} else if (z <= -8.5e+80) {
tmp = x * y;
} else if ((z <= -1.55e+19) || !(z <= 1.3e-121)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (a * b) + (z * t)
if (z <= (-1.1d+87)) then
tmp = t_1
else if (z <= (-8.5d+80)) then
tmp = x * y
else if ((z <= (-1.55d+19)) .or. (.not. (z <= 1.3d-121))) then
tmp = t_1
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 t_1 = (a * b) + (z * t);
double tmp;
if (z <= -1.1e+87) {
tmp = t_1;
} else if (z <= -8.5e+80) {
tmp = x * y;
} else if ((z <= -1.55e+19) || !(z <= 1.3e-121)) {
tmp = t_1;
} else {
tmp = (a * b) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * b) + (z * t) tmp = 0 if z <= -1.1e+87: tmp = t_1 elif z <= -8.5e+80: tmp = x * y elif (z <= -1.55e+19) or not (z <= 1.3e-121): tmp = t_1 else: tmp = (a * b) + (x * y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(z * t)) tmp = 0.0 if (z <= -1.1e+87) tmp = t_1; elseif (z <= -8.5e+80) tmp = Float64(x * y); elseif ((z <= -1.55e+19) || !(z <= 1.3e-121)) tmp = t_1; else tmp = Float64(Float64(a * b) + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * b) + (z * t); tmp = 0.0; if (z <= -1.1e+87) tmp = t_1; elseif (z <= -8.5e+80) tmp = x * y; elseif ((z <= -1.55e+19) || ~((z <= 1.3e-121))) tmp = t_1; else tmp = (a * b) + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.1e+87], t$95$1, If[LessEqual[z, -8.5e+80], N[(x * y), $MachinePrecision], If[Or[LessEqual[z, -1.55e+19], N[Not[LessEqual[z, 1.3e-121]], $MachinePrecision]], t$95$1, N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+80}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{+19} \lor \neg \left(z \leq 1.3 \cdot 10^{-121}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\end{array}
if z < -1.1e87 or -8.50000000000000007e80 < z < -1.55e19 or 1.29999999999999993e-121 < z Initial program 97.9%
Taylor expanded in x around 0 78.7%
if -1.1e87 < z < -8.50000000000000007e80Initial program 100.0%
Taylor expanded in x around inf 0.3%
if -1.55e19 < z < 1.29999999999999993e-121Initial program 100.0%
Taylor expanded in z around 0 83.8%
Final simplification80.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -2.6e+83) (not (<= (* a b) 6.6e+114))) (+ (* a b) (* z t)) (+ (* z t) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -2.6e+83) || !((a * b) <= 6.6e+114)) {
tmp = (a * b) + (z * t);
} 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) <= (-2.6d+83)) .or. (.not. ((a * b) <= 6.6d+114))) then
tmp = (a * b) + (z * t)
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) <= -2.6e+83) || !((a * b) <= 6.6e+114)) {
tmp = (a * b) + (z * t);
} else {
tmp = (z * t) + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -2.6e+83) or not ((a * b) <= 6.6e+114): tmp = (a * b) + (z * t) else: tmp = (z * t) + (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -2.6e+83) || !(Float64(a * b) <= 6.6e+114)) tmp = Float64(Float64(a * b) + Float64(z * t)); 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) <= -2.6e+83) || ~(((a * b) <= 6.6e+114))) tmp = (a * b) + (z * t); 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], -2.6e+83], N[Not[LessEqual[N[(a * b), $MachinePrecision], 6.6e+114]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.6 \cdot 10^{+83} \lor \neg \left(a \cdot b \leq 6.6 \cdot 10^{+114}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -2.6000000000000001e83 or 6.6000000000000001e114 < (*.f64 a b) Initial program 96.3%
Taylor expanded in x around 0 90.3%
if -2.6000000000000001e83 < (*.f64 a b) < 6.6000000000000001e114Initial program 100.0%
Taylor expanded in a around 0 86.1%
Final simplification87.4%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -1.45e+69) (* a b) (if (<= (* a b) 3.9e+133) (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -1.45e+69) {
tmp = a * b;
} else if ((a * b) <= 3.9e+133) {
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) <= (-1.45d+69)) then
tmp = a * b
else if ((a * b) <= 3.9d+133) 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) <= -1.45e+69) {
tmp = a * b;
} else if ((a * b) <= 3.9e+133) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -1.45e+69: tmp = a * b elif (a * b) <= 3.9e+133: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -1.45e+69) tmp = Float64(a * b); elseif (Float64(a * b) <= 3.9e+133) 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) <= -1.45e+69) tmp = a * b; elseif ((a * b) <= 3.9e+133) 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], -1.45e+69], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.9e+133], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.45 \cdot 10^{+69}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 3.9 \cdot 10^{+133}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.4499999999999999e69 or 3.90000000000000014e133 < (*.f64 a b) Initial program 96.2%
Taylor expanded in a around inf 72.9%
if -1.4499999999999999e69 < (*.f64 a b) < 3.90000000000000014e133Initial program 100.0%
Taylor expanded in z around inf 45.3%
Final simplification53.7%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (+ (* z t) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((z * t) + (x * y));
}
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) + ((z * t) + (x * y))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((z * t) + (x * y));
}
def code(x, y, z, t, a, b): return (a * b) + ((z * t) + (x * y))
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) end
function tmp = code(x, y, z, t, a, b) tmp = (a * b) + ((z * t) + (x * y)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \left(z \cdot t + x \cdot y\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 32.5%
Final simplification32.5%
herbie shell --seed 2023221
(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)))