
(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 (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.4%
+-commutative98.4%
fma-def99.6%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(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 98.4%
fma-def98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -52000.0)
(* x y)
(if (<= (* x y) -4e-70)
(* a b)
(if (<= (* x y) -6.8e-304)
(* z t)
(if (<= (* x y) 1.2e-262)
(* a b)
(if (<= (* x y) 1.85e-172)
(* z t)
(if (<= (* x y) 1.9e-114)
(* a b)
(if (<= (* x y) 4.4e+133) (* z t) (* x y)))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -52000.0) {
tmp = x * y;
} else if ((x * y) <= -4e-70) {
tmp = a * b;
} else if ((x * y) <= -6.8e-304) {
tmp = z * t;
} else if ((x * y) <= 1.2e-262) {
tmp = a * b;
} else if ((x * y) <= 1.85e-172) {
tmp = z * t;
} else if ((x * y) <= 1.9e-114) {
tmp = a * b;
} else if ((x * y) <= 4.4e+133) {
tmp = 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 * y) <= (-52000.0d0)) then
tmp = x * y
else if ((x * y) <= (-4d-70)) then
tmp = a * b
else if ((x * y) <= (-6.8d-304)) then
tmp = z * t
else if ((x * y) <= 1.2d-262) then
tmp = a * b
else if ((x * y) <= 1.85d-172) then
tmp = z * t
else if ((x * y) <= 1.9d-114) then
tmp = a * b
else if ((x * y) <= 4.4d+133) then
tmp = 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 * y) <= -52000.0) {
tmp = x * y;
} else if ((x * y) <= -4e-70) {
tmp = a * b;
} else if ((x * y) <= -6.8e-304) {
tmp = z * t;
} else if ((x * y) <= 1.2e-262) {
tmp = a * b;
} else if ((x * y) <= 1.85e-172) {
tmp = z * t;
} else if ((x * y) <= 1.9e-114) {
tmp = a * b;
} else if ((x * y) <= 4.4e+133) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -52000.0: tmp = x * y elif (x * y) <= -4e-70: tmp = a * b elif (x * y) <= -6.8e-304: tmp = z * t elif (x * y) <= 1.2e-262: tmp = a * b elif (x * y) <= 1.85e-172: tmp = z * t elif (x * y) <= 1.9e-114: tmp = a * b elif (x * y) <= 4.4e+133: tmp = z * t else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -52000.0) tmp = Float64(x * y); elseif (Float64(x * y) <= -4e-70) tmp = Float64(a * b); elseif (Float64(x * y) <= -6.8e-304) tmp = Float64(z * t); elseif (Float64(x * y) <= 1.2e-262) tmp = Float64(a * b); elseif (Float64(x * y) <= 1.85e-172) tmp = Float64(z * t); elseif (Float64(x * y) <= 1.9e-114) tmp = Float64(a * b); elseif (Float64(x * y) <= 4.4e+133) tmp = 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 * y) <= -52000.0) tmp = x * y; elseif ((x * y) <= -4e-70) tmp = a * b; elseif ((x * y) <= -6.8e-304) tmp = z * t; elseif ((x * y) <= 1.2e-262) tmp = a * b; elseif ((x * y) <= 1.85e-172) tmp = z * t; elseif ((x * y) <= 1.9e-114) tmp = a * b; elseif ((x * y) <= 4.4e+133) tmp = z * t; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -52000.0], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -4e-70], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -6.8e-304], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.2e-262], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.85e-172], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.9e-114], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4.4e+133], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -52000:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-70}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq -6.8 \cdot 10^{-304}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 1.2 \cdot 10^{-262}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 1.85 \cdot 10^{-172}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 1.9 \cdot 10^{-114}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 4.4 \cdot 10^{+133}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -52000 or 4.4e133 < (*.f64 x y) Initial program 98.1%
Taylor expanded in x around inf 68.9%
if -52000 < (*.f64 x y) < -3.99999999999999998e-70 or -6.7999999999999997e-304 < (*.f64 x y) < 1.2e-262 or 1.85e-172 < (*.f64 x y) < 1.8999999999999999e-114Initial program 98.5%
Taylor expanded in a around inf 68.0%
if -3.99999999999999998e-70 < (*.f64 x y) < -6.7999999999999997e-304 or 1.2e-262 < (*.f64 x y) < 1.85e-172 or 1.8999999999999999e-114 < (*.f64 x y) < 4.4e133Initial program 98.8%
Taylor expanded in z around inf 63.9%
Final simplification67.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* a b) (* x y))))
(if (<= (* a b) -3.3e+177)
t_1
(if (<= (* a b) -1.86e-59)
(+ (* a b) (* z t))
(if (<= (* a b) 2.7e+53) (+ (* x y) (* z t)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + (x * y);
double tmp;
if ((a * b) <= -3.3e+177) {
tmp = t_1;
} else if ((a * b) <= -1.86e-59) {
tmp = (a * b) + (z * t);
} else if ((a * b) <= 2.7e+53) {
tmp = (x * y) + (z * t);
} else {
tmp = t_1;
}
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) + (x * y)
if ((a * b) <= (-3.3d+177)) then
tmp = t_1
else if ((a * b) <= (-1.86d-59)) then
tmp = (a * b) + (z * t)
else if ((a * b) <= 2.7d+53) then
tmp = (x * y) + (z * t)
else
tmp = t_1
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) + (x * y);
double tmp;
if ((a * b) <= -3.3e+177) {
tmp = t_1;
} else if ((a * b) <= -1.86e-59) {
tmp = (a * b) + (z * t);
} else if ((a * b) <= 2.7e+53) {
tmp = (x * y) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * b) + (x * y) tmp = 0 if (a * b) <= -3.3e+177: tmp = t_1 elif (a * b) <= -1.86e-59: tmp = (a * b) + (z * t) elif (a * b) <= 2.7e+53: tmp = (x * y) + (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(x * y)) tmp = 0.0 if (Float64(a * b) <= -3.3e+177) tmp = t_1; elseif (Float64(a * b) <= -1.86e-59) tmp = Float64(Float64(a * b) + Float64(z * t)); elseif (Float64(a * b) <= 2.7e+53) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * b) + (x * y); tmp = 0.0; if ((a * b) <= -3.3e+177) tmp = t_1; elseif ((a * b) <= -1.86e-59) tmp = (a * b) + (z * t); elseif ((a * b) <= 2.7e+53) tmp = (x * y) + (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -3.3e+177], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], -1.86e-59], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.7e+53], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
\mathbf{if}\;a \cdot b \leq -3.3 \cdot 10^{+177}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq -1.86 \cdot 10^{-59}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 2.7 \cdot 10^{+53}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 a b) < -3.3000000000000001e177 or 2.70000000000000019e53 < (*.f64 a b) Initial program 96.4%
Taylor expanded in z around 0 87.9%
if -3.3000000000000001e177 < (*.f64 a b) < -1.86000000000000004e-59Initial program 100.0%
Taylor expanded in x around 0 89.1%
if -1.86000000000000004e-59 < (*.f64 a b) < 2.70000000000000019e53Initial program 99.2%
Taylor expanded in a around 0 93.1%
Final simplification90.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -5.5) (not (<= (* x y) 7e+133))) (+ (* 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) <= -5.5) || !((x * y) <= 7e+133)) {
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) <= (-5.5d0)) .or. (.not. ((x * y) <= 7d+133))) 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) <= -5.5) || !((x * y) <= 7e+133)) {
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) <= -5.5) or not ((x * y) <= 7e+133): 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) <= -5.5) || !(Float64(x * y) <= 7e+133)) 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) <= -5.5) || ~(((x * y) <= 7e+133))) 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], -5.5], N[Not[LessEqual[N[(x * y), $MachinePrecision], 7e+133]], $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 -5.5 \lor \neg \left(x \cdot y \leq 7 \cdot 10^{+133}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -5.5 or 6.9999999999999997e133 < (*.f64 x y) Initial program 98.1%
Taylor expanded in z around 0 85.4%
if -5.5 < (*.f64 x y) < 6.9999999999999997e133Initial program 98.6%
Taylor expanded in x around 0 88.4%
Final simplification87.1%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -2.9e+99) (* x y) (if (<= (* x y) 6.1e+140) (+ (* a b) (* z t)) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -2.9e+99) {
tmp = x * y;
} else if ((x * y) <= 6.1e+140) {
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 * y) <= (-2.9d+99)) then
tmp = x * y
else if ((x * y) <= 6.1d+140) 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 * y) <= -2.9e+99) {
tmp = x * y;
} else if ((x * y) <= 6.1e+140) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -2.9e+99: tmp = x * y elif (x * y) <= 6.1e+140: tmp = (a * b) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -2.9e+99) tmp = Float64(x * y); elseif (Float64(x * y) <= 6.1e+140) 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 * y) <= -2.9e+99) tmp = x * y; elseif ((x * y) <= 6.1e+140) tmp = (a * b) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -2.9e+99], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6.1e+140], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.9 \cdot 10^{+99}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 6.1 \cdot 10^{+140}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -2.9000000000000002e99 or 6.0999999999999996e140 < (*.f64 x y) Initial program 97.9%
Taylor expanded in x around inf 73.6%
if -2.9000000000000002e99 < (*.f64 x y) < 6.0999999999999996e140Initial program 98.7%
Taylor expanded in x around 0 86.4%
Final simplification81.7%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -740000.0) (* a b) (if (<= (* a b) 7.4e+102) (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -740000.0) {
tmp = a * b;
} else if ((a * b) <= 7.4e+102) {
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) <= (-740000.0d0)) then
tmp = a * b
else if ((a * b) <= 7.4d+102) 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) <= -740000.0) {
tmp = a * b;
} else if ((a * b) <= 7.4e+102) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -740000.0: tmp = a * b elif (a * b) <= 7.4e+102: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -740000.0) tmp = Float64(a * b); elseif (Float64(a * b) <= 7.4e+102) 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) <= -740000.0) tmp = a * b; elseif ((a * b) <= 7.4e+102) 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], -740000.0], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 7.4e+102], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -740000:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 7.4 \cdot 10^{+102}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -7.4e5 or 7.40000000000000045e102 < (*.f64 a b) Initial program 97.0%
Taylor expanded in a around inf 66.6%
if -7.4e5 < (*.f64 a b) < 7.40000000000000045e102Initial program 99.3%
Taylor expanded in z around inf 51.2%
Final simplification57.4%
(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.4%
Final simplification98.4%
(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.4%
Taylor expanded in a around inf 33.1%
Final simplification33.1%
herbie shell --seed 2023290
(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)))