
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= b -55000000000.0) (fma b a (fma i c (* t z))) (fma z t (fma y x (fma i c (* a b))))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (b <= -55000000000.0) {
tmp = fma(b, a, fma(i, c, (t * z)));
} else {
tmp = fma(z, t, fma(y, x, fma(i, c, (a * b))));
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (b <= -55000000000.0) tmp = fma(b, a, fma(i, c, Float64(t * z))); else tmp = fma(z, t, fma(y, x, fma(i, c, Float64(a * b)))); end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[b, -55000000000.0], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(y * x + N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -55000000000:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \mathsf{fma}\left(i, c, a \cdot b\right)\right)\right)\\
\end{array}
\end{array}
if b < -5.5e10Initial program 84.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6477.5
Applied rewrites77.5%
if -5.5e10 < b Initial program 98.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification94.4%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* y x) (* t z))))
(if (<= t_1 -2e+138)
(fma y x (* t z))
(if (<= t_1 -4e+95)
(fma z t (* i c))
(if (<= t_1 2e+126) (fma i c (* a b)) (fma z t (* y x)))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (y * x) + (t * z);
double tmp;
if (t_1 <= -2e+138) {
tmp = fma(y, x, (t * z));
} else if (t_1 <= -4e+95) {
tmp = fma(z, t, (i * c));
} else if (t_1 <= 2e+126) {
tmp = fma(i, c, (a * b));
} else {
tmp = fma(z, t, (y * x));
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(y * x) + Float64(t * z)) tmp = 0.0 if (t_1 <= -2e+138) tmp = fma(y, x, Float64(t * z)); elseif (t_1 <= -4e+95) tmp = fma(z, t, Float64(i * c)); elseif (t_1 <= 2e+126) tmp = fma(i, c, Float64(a * b)); else tmp = fma(z, t, Float64(y * x)); end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+138], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -4e+95], N[(z * t + N[(i * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+126], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(y * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := y \cdot x + t \cdot z\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(z, t, i \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, y \cdot x\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -2.0000000000000001e138Initial program 94.8%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.8
Applied rewrites93.8%
Taylor expanded in b around 0
Applied rewrites82.0%
if -2.0000000000000001e138 < (+.f64 (*.f64 x y) (*.f64 z t)) < -4.00000000000000008e95Initial program 100.0%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6482.8
Applied rewrites82.8%
if -4.00000000000000008e95 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999985e126Initial program 97.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6473.0
Applied rewrites73.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6473.9
Applied rewrites73.9%
if 1.99999999999999985e126 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 92.1%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.4
Applied rewrites97.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6485.1
Applied rewrites85.1%
Final simplification79.6%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* t z))) (t_2 (+ (* y x) (* t z))))
(if (<= t_2 -2e+138)
t_1
(if (<= t_2 -4e+95)
(fma z t (* i c))
(if (<= t_2 2e+126) (fma i c (* a b)) t_1)))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, x, (t * z));
double t_2 = (y * x) + (t * z);
double tmp;
if (t_2 <= -2e+138) {
tmp = t_1;
} else if (t_2 <= -4e+95) {
tmp = fma(z, t, (i * c));
} else if (t_2 <= 2e+126) {
tmp = fma(i, c, (a * b));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(t * z)) t_2 = Float64(Float64(y * x) + Float64(t * z)) tmp = 0.0 if (t_2 <= -2e+138) tmp = t_1; elseif (t_2 <= -4e+95) tmp = fma(z, t, Float64(i * c)); elseif (t_2 <= 2e+126) tmp = fma(i, c, Float64(a * b)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * x), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+138], t$95$1, If[LessEqual[t$95$2, -4e+95], N[(z * t + N[(i * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+126], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, t \cdot z\right)\\
t_2 := y \cdot x + t \cdot z\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -4 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(z, t, i \cdot c\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -2.0000000000000001e138 or 1.99999999999999985e126 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 93.3%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.9
Applied rewrites90.9%
Taylor expanded in b around 0
Applied rewrites83.0%
if -2.0000000000000001e138 < (+.f64 (*.f64 x y) (*.f64 z t)) < -4.00000000000000008e95Initial program 100.0%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6482.8
Applied rewrites82.8%
if -4.00000000000000008e95 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999985e126Initial program 97.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6473.0
Applied rewrites73.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6473.9
Applied rewrites73.9%
Final simplification79.2%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* t z) -1.1e+91)
(* t z)
(if (<= (* t z) -4000000.0)
(* i c)
(if (<= (* t z) 5.5e-197)
(* y x)
(if (<= (* t z) 1.65e+76) (* a b) (* t z))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((t * z) <= -1.1e+91) {
tmp = t * z;
} else if ((t * z) <= -4000000.0) {
tmp = i * c;
} else if ((t * z) <= 5.5e-197) {
tmp = y * x;
} else if ((t * z) <= 1.65e+76) {
tmp = a * b;
} else {
tmp = t * z;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((t * z) <= (-1.1d+91)) then
tmp = t * z
else if ((t * z) <= (-4000000.0d0)) then
tmp = i * c
else if ((t * z) <= 5.5d-197) then
tmp = y * x
else if ((t * z) <= 1.65d+76) then
tmp = a * b
else
tmp = t * z
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((t * z) <= -1.1e+91) {
tmp = t * z;
} else if ((t * z) <= -4000000.0) {
tmp = i * c;
} else if ((t * z) <= 5.5e-197) {
tmp = y * x;
} else if ((t * z) <= 1.65e+76) {
tmp = a * b;
} else {
tmp = t * z;
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (t * z) <= -1.1e+91: tmp = t * z elif (t * z) <= -4000000.0: tmp = i * c elif (t * z) <= 5.5e-197: tmp = y * x elif (t * z) <= 1.65e+76: tmp = a * b else: tmp = t * z return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(t * z) <= -1.1e+91) tmp = Float64(t * z); elseif (Float64(t * z) <= -4000000.0) tmp = Float64(i * c); elseif (Float64(t * z) <= 5.5e-197) tmp = Float64(y * x); elseif (Float64(t * z) <= 1.65e+76) tmp = Float64(a * b); else tmp = Float64(t * z); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((t * z) <= -1.1e+91)
tmp = t * z;
elseif ((t * z) <= -4000000.0)
tmp = i * c;
elseif ((t * z) <= 5.5e-197)
tmp = y * x;
elseif ((t * z) <= 1.65e+76)
tmp = a * b;
else
tmp = t * z;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(t * z), $MachinePrecision], -1.1e+91], N[(t * z), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], -4000000.0], N[(i * c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5.5e-197], N[(y * x), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1.65e+76], N[(a * b), $MachinePrecision], N[(t * z), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -1.1 \cdot 10^{+91}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;t \cdot z \leq -4000000:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;t \cdot z \leq 5.5 \cdot 10^{-197}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;t \cdot z \leq 1.65 \cdot 10^{+76}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -1.1e91 or 1.65e76 < (*.f64 z t) Initial program 94.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6469.9
Applied rewrites69.9%
if -1.1e91 < (*.f64 z t) < -4e6Initial program 84.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6454.4
Applied rewrites54.4%
if -4e6 < (*.f64 z t) < 5.50000000000000037e-197Initial program 97.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6447.5
Applied rewrites47.5%
if 5.50000000000000037e-197 < (*.f64 z t) < 1.65e76Initial program 95.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6440.4
Applied rewrites40.4%
Final simplification54.1%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma y x (* t z))) (t_2 (+ (* y x) (* t z)))) (if (<= t_2 -1e+94) t_1 (if (<= t_2 2e+126) (fma i c (* a b)) t_1))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, x, (t * z));
double t_2 = (y * x) + (t * z);
double tmp;
if (t_2 <= -1e+94) {
tmp = t_1;
} else if (t_2 <= 2e+126) {
tmp = fma(i, c, (a * b));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(t * z)) t_2 = Float64(Float64(y * x) + Float64(t * z)) tmp = 0.0 if (t_2 <= -1e+94) tmp = t_1; elseif (t_2 <= 2e+126) tmp = fma(i, c, Float64(a * b)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * x), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+94], t$95$1, If[LessEqual[t$95$2, 2e+126], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, t \cdot z\right)\\
t_2 := y \cdot x + t \cdot z\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -1e94 or 1.99999999999999985e126 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 94.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.7
Applied rewrites88.7%
Taylor expanded in b around 0
Applied rewrites79.8%
if -1e94 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999985e126Initial program 97.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6473.5
Applied rewrites73.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6474.5
Applied rewrites74.5%
Final simplification77.6%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (fma i c (* t z)))))
(if (<= (* a b) -1e+213)
t_1
(if (<= (* a b) 50000000000000.0) (fma z t (fma y x (* i c))) t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, fma(i, c, (t * z)));
double tmp;
if ((a * b) <= -1e+213) {
tmp = t_1;
} else if ((a * b) <= 50000000000000.0) {
tmp = fma(z, t, fma(y, x, (i * c)));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, fma(i, c, Float64(t * z))) tmp = 0.0 if (Float64(a * b) <= -1e+213) tmp = t_1; elseif (Float64(a * b) <= 50000000000000.0) tmp = fma(z, t, fma(y, x, Float64(i * c))); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+213], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 50000000000000.0], N[(z * t + N[(y * x + N[(i * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 50000000000000:\\
\;\;\;\;\mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, i \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -9.99999999999999984e212 or 5e13 < (*.f64 a b) Initial program 89.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.4
Applied rewrites90.4%
if -9.99999999999999984e212 < (*.f64 a b) < 5e13Initial program 99.3%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
Final simplification93.7%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (fma i c (* t z)))))
(if (<= (* a b) -1e+213)
t_1
(if (<= (* a b) 50000000000000.0) (fma i c (fma y x (* t z))) t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, fma(i, c, (t * z)));
double tmp;
if ((a * b) <= -1e+213) {
tmp = t_1;
} else if ((a * b) <= 50000000000000.0) {
tmp = fma(i, c, fma(y, x, (t * z)));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, fma(i, c, Float64(t * z))) tmp = 0.0 if (Float64(a * b) <= -1e+213) tmp = t_1; elseif (Float64(a * b) <= 50000000000000.0) tmp = fma(i, c, fma(y, x, Float64(t * z))); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+213], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 50000000000000.0], N[(i * c + N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 50000000000000:\\
\;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(y, x, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -9.99999999999999984e212 or 5e13 < (*.f64 a b) Initial program 89.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.4
Applied rewrites90.4%
if -9.99999999999999984e212 < (*.f64 a b) < 5e13Initial program 99.3%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6495.3
Applied rewrites95.3%
Final simplification93.3%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (fma i c (* t z)))))
(if (<= (* i c) -2e+117)
t_1
(if (<= (* i c) 5e+86) (fma b a (fma y x (* t z))) t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, fma(i, c, (t * z)));
double tmp;
if ((i * c) <= -2e+117) {
tmp = t_1;
} else if ((i * c) <= 5e+86) {
tmp = fma(b, a, fma(y, x, (t * z)));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, fma(i, c, Float64(t * z))) tmp = 0.0 if (Float64(i * c) <= -2e+117) tmp = t_1; elseif (Float64(i * c) <= 5e+86) tmp = fma(b, a, fma(y, x, Float64(t * z))); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(i * c), $MachinePrecision], -2e+117], t$95$1, If[LessEqual[N[(i * c), $MachinePrecision], 5e+86], N[(b * a + N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{if}\;i \cdot c \leq -2 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \cdot c \leq 5 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 c i) < -2.0000000000000001e117 or 4.9999999999999998e86 < (*.f64 c i) Initial program 90.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
if -2.0000000000000001e117 < (*.f64 c i) < 4.9999999999999998e86Initial program 97.7%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.5
Applied rewrites90.5%
Final simplification88.6%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (* y x) -2e+138) (fma y x (* t z)) (if (<= (* y x) 5e+149) (fma b a (fma i c (* t z))) (fma i c (* y x)))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((y * x) <= -2e+138) {
tmp = fma(y, x, (t * z));
} else if ((y * x) <= 5e+149) {
tmp = fma(b, a, fma(i, c, (t * z)));
} else {
tmp = fma(i, c, (y * x));
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(y * x) <= -2e+138) tmp = fma(y, x, Float64(t * z)); elseif (Float64(y * x) <= 5e+149) tmp = fma(b, a, fma(i, c, Float64(t * z))); else tmp = fma(i, c, Float64(y * x)); end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(y * x), $MachinePrecision], -2e+138], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 5e+149], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -2 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{elif}\;y \cdot x \leq 5 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e138Initial program 94.6%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.7
Applied rewrites92.7%
Taylor expanded in b around 0
Applied rewrites82.2%
if -2.0000000000000001e138 < (*.f64 x y) < 4.9999999999999999e149Initial program 97.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.9
Applied rewrites86.9%
if 4.9999999999999999e149 < (*.f64 x y) Initial program 87.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6416.9
Applied rewrites16.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6416.9
Applied rewrites16.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6484.0
Applied rewrites84.0%
Final simplification85.6%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1e+213) (* a b) (if (<= (* a b) 5e-260) (* y x) (if (<= (* a b) 5e+50) (* i c) (* a b)))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1e+213) {
tmp = a * b;
} else if ((a * b) <= 5e-260) {
tmp = y * x;
} else if ((a * b) <= 5e+50) {
tmp = i * c;
} else {
tmp = a * b;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((a * b) <= (-1d+213)) then
tmp = a * b
else if ((a * b) <= 5d-260) then
tmp = y * x
else if ((a * b) <= 5d+50) then
tmp = i * c
else
tmp = a * b
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1e+213) {
tmp = a * b;
} else if ((a * b) <= 5e-260) {
tmp = y * x;
} else if ((a * b) <= 5e+50) {
tmp = i * c;
} else {
tmp = a * b;
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1e+213: tmp = a * b elif (a * b) <= 5e-260: tmp = y * x elif (a * b) <= 5e+50: tmp = i * c else: tmp = a * b return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1e+213) tmp = Float64(a * b); elseif (Float64(a * b) <= 5e-260) tmp = Float64(y * x); elseif (Float64(a * b) <= 5e+50) tmp = Float64(i * c); else tmp = Float64(a * b); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((a * b) <= -1e+213)
tmp = a * b;
elseif ((a * b) <= 5e-260)
tmp = y * x;
elseif ((a * b) <= 5e+50)
tmp = i * c;
else
tmp = a * b;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e+213], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e-260], N[(y * x), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+50], N[(i * c), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+213}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-260}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+50}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -9.99999999999999984e212 or 5e50 < (*.f64 a b) Initial program 87.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
if -9.99999999999999984e212 < (*.f64 a b) < 5.0000000000000003e-260Initial program 99.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6449.1
Applied rewrites49.1%
if 5.0000000000000003e-260 < (*.f64 a b) < 5e50Initial program 100.0%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6437.4
Applied rewrites37.4%
Final simplification49.8%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (* t z) -4.4e+60) (fma y x (* t z)) (if (<= (* t z) 3.85e+59) (fma b a (* y x)) (fma b a (* t z)))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((t * z) <= -4.4e+60) {
tmp = fma(y, x, (t * z));
} else if ((t * z) <= 3.85e+59) {
tmp = fma(b, a, (y * x));
} else {
tmp = fma(b, a, (t * z));
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(t * z) <= -4.4e+60) tmp = fma(y, x, Float64(t * z)); elseif (Float64(t * z) <= 3.85e+59) tmp = fma(b, a, Float64(y * x)); else tmp = fma(b, a, Float64(t * z)); end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(t * z), $MachinePrecision], -4.4e+60], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 3.85e+59], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -4.4 \cdot 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{elif}\;t \cdot z \leq 3.85 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -4.39999999999999992e60Initial program 96.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.5
Applied rewrites86.5%
Taylor expanded in b around 0
Applied rewrites80.6%
if -4.39999999999999992e60 < (*.f64 z t) < 3.84999999999999993e59Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6471.7
Applied rewrites71.7%
Taylor expanded in t around 0
Applied rewrites68.9%
if 3.84999999999999993e59 < (*.f64 z t) Initial program 93.2%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.9
Applied rewrites87.9%
Taylor expanded in t around inf
Applied rewrites82.2%
Final simplification73.5%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* t z))))
(if (<= (* t z) -4.4e+60)
t_1
(if (<= (* t z) 4.4e+68) (fma b a (* y x)) t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, x, (t * z));
double tmp;
if ((t * z) <= -4.4e+60) {
tmp = t_1;
} else if ((t * z) <= 4.4e+68) {
tmp = fma(b, a, (y * x));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(t * z)) tmp = 0.0 if (Float64(t * z) <= -4.4e+60) tmp = t_1; elseif (Float64(t * z) <= 4.4e+68) tmp = fma(b, a, Float64(y * x)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -4.4e+60], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 4.4e+68], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{if}\;t \cdot z \leq -4.4 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 4.4 \cdot 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.39999999999999992e60 or 4.39999999999999974e68 < (*.f64 z t) Initial program 94.5%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.9
Applied rewrites87.9%
Taylor expanded in b around 0
Applied rewrites81.7%
if -4.39999999999999992e60 < (*.f64 z t) < 4.39999999999999974e68Initial program 95.7%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6471.5
Applied rewrites71.5%
Taylor expanded in t around 0
Applied rewrites68.7%
Final simplification73.4%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (* i c) -2e+105) (* i c) (if (<= (* i c) 4e+297) (fma y x (* t z)) (* i c))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((i * c) <= -2e+105) {
tmp = i * c;
} else if ((i * c) <= 4e+297) {
tmp = fma(y, x, (t * z));
} else {
tmp = i * c;
}
return tmp;
}
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(i * c) <= -2e+105) tmp = Float64(i * c); elseif (Float64(i * c) <= 4e+297) tmp = fma(y, x, Float64(t * z)); else tmp = Float64(i * c); end return tmp end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(i * c), $MachinePrecision], -2e+105], N[(i * c), $MachinePrecision], If[LessEqual[N[(i * c), $MachinePrecision], 4e+297], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(i * c), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;i \cdot c \leq -2 \cdot 10^{+105}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;i \cdot c \leq 4 \cdot 10^{+297}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 c i) < -1.9999999999999999e105 or 4.0000000000000001e297 < (*.f64 c i) Initial program 87.2%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6475.2
Applied rewrites75.2%
if -1.9999999999999999e105 < (*.f64 c i) < 4.0000000000000001e297Initial program 97.5%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.5
Applied rewrites87.5%
Taylor expanded in b around 0
Applied rewrites65.5%
Final simplification67.5%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= (* i c) -4e-31) (* i c) (if (<= (* i c) 1e+57) (* a b) (* i c))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((i * c) <= -4e-31) {
tmp = i * c;
} else if ((i * c) <= 1e+57) {
tmp = a * b;
} else {
tmp = i * c;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((i * c) <= (-4d-31)) then
tmp = i * c
else if ((i * c) <= 1d+57) then
tmp = a * b
else
tmp = i * c
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((i * c) <= -4e-31) {
tmp = i * c;
} else if ((i * c) <= 1e+57) {
tmp = a * b;
} else {
tmp = i * c;
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (i * c) <= -4e-31: tmp = i * c elif (i * c) <= 1e+57: tmp = a * b else: tmp = i * c return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(i * c) <= -4e-31) tmp = Float64(i * c); elseif (Float64(i * c) <= 1e+57) tmp = Float64(a * b); else tmp = Float64(i * c); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((i * c) <= -4e-31)
tmp = i * c;
elseif ((i * c) <= 1e+57)
tmp = a * b;
else
tmp = i * c;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(i * c), $MachinePrecision], -4e-31], N[(i * c), $MachinePrecision], If[LessEqual[N[(i * c), $MachinePrecision], 1e+57], N[(a * b), $MachinePrecision], N[(i * c), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;i \cdot c \leq -4 \cdot 10^{-31}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;i \cdot c \leq 10^{+57}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 c i) < -4e-31 or 1.00000000000000005e57 < (*.f64 c i) Initial program 92.3%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6447.1
Applied rewrites47.1%
if -4e-31 < (*.f64 c i) < 1.00000000000000005e57Initial program 97.8%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6431.9
Applied rewrites31.9%
Final simplification38.9%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (* a b))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = a * b
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): return a * b
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp = code(x, y, z, t, a, b, c, i)
tmp = a * b;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
a \cdot b
\end{array}
Initial program 95.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6425.0
Applied rewrites25.0%
Final simplification25.0%
herbie shell --seed 2024268
(FPCore (x y z t a b c i)
:name "Linear.V4:$cdot from linear-1.19.1.3, C"
:precision binary64
(+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))