
/* Tests for interpolate */

/* Test #1 */
restart;
write("Test #1\n");

X = [|1,2,3,4,5|];
Y = [|2,3,7,17,42|];

p = interpolate(X, Y);

write("p = ", p, "\n");
YY = [||];
for iks in X do {
    YY = p(iks) .: YY;
};
YY = revert(YY);

write("Y  = ", Y, "\n");
write("YY = ", YY, "\n");
write("Y == YY: ", Y == YY, "\n");
write("degree(p) = ", degree(p), "\n");

/* Test #2 */
restart;
write("Test #2\n");

X = [|1,...,17|];

q = 1 + x + x^2 + 3 * x^3 + 19 * x^4 + 42 * x^5 + 17 * x^6 + x^7 + 1664 * x^8 + 1789 * x^9 +
    24 * x^10 + 4 * x^11 + 2 * x^12 + 6 * x^13 + 6 * x^14 + 7 * x^15 + x^16 + 23 * x^17;

Y = [||];
for iks in X do {
    Y = q(iks) .: Y;
};
Y = revert(Y);

p = interpolate(X, Y);

write("p = ", p, "\n");
YY = [||];
for iks in X do {
    YY = p(iks) .: YY;
};
YY = revert(YY);

write("Y  = ", Y, "\n");
write("YY = ", YY, "\n");
write("Y == YY: ", Y == YY, "\n");
write("degree(p) = ", degree(p), "\n");

/* Test #3 */
restart;
write("Test #3\n");

X = [|1,...,17|];

q = 1 + x + x^2 + 3 * x^3 + 19 * x^4 + 42 * x^5 + 17 * x^6 + x^7 + 1664 * x^8 + 1789 * x^9 +
    24 * x^10 + 4 * x^11 + 2 * x^12 + 6 * x^13 + 6 * x^14 + 7 * x^15 + 23 * x^16;

Y = [||];
for iks in X do {
    Y = q(iks) .: Y;
};
Y = revert(Y);

p = interpolate(X, Y);

write("p = ", p, "\n");
YY = [||];
for iks in X do {
    YY = p(iks) .: YY;
};
YY = revert(YY);

write("Y  = ", Y, "\n");
write("YY = ", YY, "\n");
write("Y == YY: ", Y == YY, "\n");
write("degree(p) = ", degree(p), "\n");
write("degree(q) = ", degree(q), "\n");
write("q = ", q, "\n");
write("p == q: ", p == q, "\n");

/* Test #4 */
restart;
suppressmessage(171,61);
write("Test #4\n");

X = [|1,...,50|];
Y = X;

p = interpolate(X, Y);

write("p = ", p, "\n");
YY = [||];
for iks in X do {
    YY = p(iks) .: YY;
};
YY = revert(YY);

write("Y  = ", Y, "\n");
write("YY = ", YY, "\n");
write("Y == YY: ", Y == YY, "\n");
write("degree(p) = ", degree(p), "\n");

/* Test #5 */
restart;
suppressmessage(171,61);
write("Test #5\n");

X = [|1,...,2000|];
Y = X;

p = interpolate(X, Y);

write("p = ", p, "\n");
YY = [||];
for iks in X do {
    YY = p(iks) .: YY;
};
YY = revert(YY);

write("Y  = ", Y, "\n");
write("YY = ", YY, "\n");
write("Y == YY: ", Y == YY, "\n");
write("degree(p) = ", degree(p), "\n");

/* Test #6 */
restart;
suppressmessage(171,61);
write("Test #6\n");

X = [|1,...,50|];
Y = [||];
for iks in X do {
    Y = simplify((-1)^mod(iks,2)) .: Y;
};
Y = revert(Y);

p = interpolate(X, Y);

write("p = ", p, "\n");
YY = [||];
for iks in X do {
    YY = p(iks) .: YY;
};
YY = revert(YY);

write("Y  = ", Y, "\n");
write("YY = ", YY, "\n");
write("Y == YY: ", Y == YY, "\n");
write("degree(p) = ", degree(p), "\n");

/* Test #7 */
restart;
suppressmessage(171,61);
write("Test #7\n");

X = [|1,...,501|];
Y = [||];
for iks in X do {
    Y = simplify((-1)^mod(iks,2)) .: Y;
};
Y = revert(Y);

p = interpolate(X, Y);

write("p = ", p, "\n");
YY = [||];
for iks in X do {
    YY = p(iks) .: YY;
};
YY = revert(YY);

write("Y  = ", Y, "\n");
write("YY = ", YY, "\n");
write("Y == YY: ", Y == YY, "\n");
write("degree(p) = ", degree(p), "\n");

/* Test #8 */
restart;
suppressmessage(171,61);
write("Test #8\n");

X = [||];
for iks from -1 to 1 by 1/10 do {
    X = iks .: X;
};
X = revert(X);

f = exp(x);

p = interpolate(X, f);

"p = ", p;
maxDelta = sup(evaluate(p - f, [X[0]]));
for iks in X do {
    maxDelta = max(maxDelta, sup(evaluate(p - f, [iks])));
};
"abs(maxDelta) < 1b-20000: ", abs(maxDelta) < 1b-20000;
"degree(p) = ", degree(p);

/* Test #9 */
restart;
suppressmessage(171,61);
write("Test #9\n");

X = [||];
for iks from -1 to 1 by 1/16 do {
    X = iks .: X;
};
X = revert(X);

f = sin(x);

p = interpolate(X, f);

"p = ", p;

prec = 4000!;
for iks in X do {
    "abs((p - f)(x)) < 1b-2000 at x = ", iks, ": ", ((-1b-2000 < inf((p - f)([iks]))) && (sup((p - f)([iks])) < 1b-2000));
};
"degree(p) = ", degree(p);

/* Test #10 */
restart;
suppressmessage(171,457,57,61);
write("Test #10\n");

f = exp(x);
a = -1;
b = 1;
n = 15;

X = [||];
for i from 0 to n do {
  iks = 1/2 * (a + b) + 1/2 * (b - a) * cos(pi * ((2 * i + 1)/(2 * (n + 1))));
  X = iks .: X;
};
X = revert(X);

p = interpolate(X, f);

"p = ", p;

prec = 4000!;
for iks in X do {
    "abs((p - f)(x)) < 1b-2000 at x = ", iks, ": ", ((-1b-2000 < inf((p - f)([iks]))) && (sup((p - f)([iks])) < 1b-2000));
};
"degree(p) = ", degree(p);
delta = dirtyinfnorm(p-f,[a;b]);
"abs(delta) < 1b-58: ", abs(delta) < 1b-58;

/* Test #11 */
restart;
suppressmessage(171,457,57,61);
write("Test #11\n");

f = exp(x);
a = -1;
b = 1;
n = 15;

X = [||];
for i from 0 to n do {
  iks := 1/2 * (a + b) + 1/2 * (b - a) * cos(pi * ((2 * i + 1)/(2 * (n + 1))));
  X = iks .: X;
};
X = revert(X);

p = interpolate(X, f);

"p = ", p;

prec = 4000!;
for iks in X do {
    "abs((p - f)(x)) < 1b-2000 at x = ", iks, ": ", ((-1b-2000 < inf((p - f)([iks]))) && (sup((p - f)([iks])) < 1b-2000));
};
"degree(p) = ", degree(p);
delta = dirtyinfnorm(p-f,[a;b]);
"abs(delta) < 1b-58: ", abs(delta) < 1b-58;

/* Test #12 */
restart;
suppressmessage(171,457,57,61);
write("Test #12\n");

f = exp(x);
a = -1;
b = 1;
n = 75;

X = [||];
for i from 0 to n do {
  iks = 1/2 * (a + b) + 1/2 * (b - a) * cos(pi * ((2 * i + 1)/(2 * (n + 1))));
  X = iks .: X;
};
X = revert(X);

p = interpolate(X, f);

"p = ", p;

prec = 4000!;
for iks in X do {
    "abs((p - f)(x)) < 1b-2000 at x = ", iks, ": ", ((-1b-2000 < inf((p - f)([iks]))) && (sup((p - f)([iks])) < 1b-2000));
};
"degree(p) = ", degree(p);
delta = dirtyinfnorm(p-f,[a;b]);
"abs(delta) < 1b-443: ", abs(delta) < 1b-443;


/* Test #13 */
restart;
suppressmessage(171,457,57,61);
write("Test #13\n");

f = cos(x);
a = -0.5;
b = 1;
n = 75;

X = [||];
for i from 0 to n do {
  iks = 1/2 * (a + b) + 1/2 * (b - a) * cos(pi * ((2 * i + 1)/(2 * (n + 1))));
  X = iks .: X;
};
X = revert(X);

p = interpolate(X, f);

"p = ", p;

prec = 4000!;
for iks in X do {
    "abs((p - f)(x)) < 1b-2000 at x = ", iks, ": ", ((-1b-2000 < inf((p - f)([iks]))) && (sup((p - f)([iks])) < 1b-2000));
};
"degree(p) = ", degree(p);
prec = default!;
delta = dirtyinfnorm(p-f,[a;b]);
"abs(delta) < 1b-475: ", abs(delta) < 1b-475;


/* Test #14*/
restart;
write("Test #14\n");

X = [|1,2,3,4,5|];
Y = [|27/10,3/28,7/19,17/23,42/101|];

p = interpolate(X, Y);
r = interpolate(X, Y, 1b-20);

write("p = ", p, "\n");
write("r = ", r, "\n");

write("p == r: ", p == r, "\n");
write("p - r = ", horner(p - r), "\n");

YY = [||];
for iks in X do {
    YY = p(iks) .: YY;
};
YY = revert(YY);

write("Y  = ", Y, "\n");
write("YY = ", YY, "\n");
write("Y == YY: ", Y == YY, "\n");
write("degree(p) = ", degree(p), "\n");
write("degree(r) = ", degree(r), "\n");
delta = dirtyinfnorm(p-r,[1;5]);
"abs(delta) < 1b-20: ", abs(delta) < 1b-20;


/* Test #15*/
restart;
write("Test #15\n");

X = [|1,...,50|];
Y = [||];
for iks in X do {
    Y = (iks/3) .: Y;
};
Y = revert(Y);

p = interpolate(X, Y);
r = interpolate(X, Y, 1b-200);

write("p = ", p, "\n");
write("r = ", r, "\n");

write("p == r: ", p == r, "\n");
write("p - r = ", horner(p - r), "\n");

YY = [||];
for iks in X do {
    YY = p(iks) .: YY;
};
YY = revert(YY);

write("Y  = ", Y, "\n");
write("YY = ", YY, "\n");
write("Y == YY: ", Y == YY, "\n");
write("degree(p) = ", degree(p), "\n");
write("degree(r) = ", degree(r), "\n");
delta = dirtyinfnorm(p-r,[1;50]);
"abs(delta) < 1b-200: ", abs(delta) < 1b-200;

/* Test #16*/
restart;
write("Test #16\n");

f = exp(x);
a = -1;
b = 1;
maxDelta = 1b-63;

X = [||];
for iks from a to b by 1/32 do {
    X = iks .: X;
};
X = revert(X);

p = interpolate(X,f);
r = interpolate(X,f,maxDelta);

prec = 4000!;
d = dirtysimplify(horner(r - p));
prec = default!;

delta = dirtyinfnorm(d, [a;b]);
"abs(delta) < ", maxDelta,": ", abs(delta) < maxDelta;

/* Test #17*/
restart;
suppressmessage(171,457,57,61);
write("Test #17\n");

f = erf(x);
a = -0.25;
b = 0.25;
n = 75;

X = [||];
for i from 0 to n do {
  iks := 1/2 * (a + b) + 1/2 * (b - a) * cos(pi * ((2 * i + 1)/(2 * (n + 1))));
  X = iks .: X;
};
X = revert(X);

p = interpolate(X, f, 1b-400);

"p = ", p;

prec = 4000!;
for iks in X do {
    "abs((p - f)(x)) < 1b-400 at x = ", iks, ": ", ((-1b-400 < inf((p - f)([iks]))) && (sup((p - f)([iks])) < 1b-400));
};
"degree(p) = ", degree(p);
prec = default!;
delta = dirtyinfnorm(p-f,[a;b]);
"abs(delta) < 1b-382: ", abs(delta) < 1b-382;

/* Test #18*/
restart;
suppressmessage(171,457,57,61);
write("Test #18\n");

f = erfc(x);
a = -1/16;
b = 1/16;
n = 15;

X = [||];
for i from 0 to n do {
  iks := 1/2 * (a + b) + 1/2 * (b - a) * cos(pi * ((2 * i + 1)/(2 * (n + 1))));
  X = iks .: X;
};
X = revert(X);

p = interpolate(X, f, 1b-122);
q = interpolate(X, f, 1b-132);
r = p - q;

"p = ", p;
"q = ", q;

prec = 4000!;
for iks in X do {
    "abs((p - f)(x)) < 1b-122 at x = ", iks, ": ", ((-1b-122 < inf((p - f)([iks]))) && (sup((p - f)([iks])) < 1b-122));
};
"degree(p) = ", degree(p);
prec = default!;
delta = dirtyinfnorm(p-f,[a;b]);
"abs(delta) < 1b-101: ", abs(delta) < 1b-101;
Delta = supnorm(p, q, [a;b], absolute, 2^(-20));
d = sup(Delta);
"abs(d) <= (1b-122 + 1b-132) * (1 + 2^(-20)): ", abs(d) < (1b-122 + 1b-132) * (1 + 2^(-20));


/* Test #19 */
restart;
suppressmessage(171,457,57,61);
write("Test #19\n");

q = (x + 1/7 * 1b-10) * (x + (1 + 1/13)) * (x - (1 + 1/17)) * (x - 2 * (1 + 1/19));

X = [|100b-50, 101b-50, 102b-50, 103b-50, 104b-50|];

ps = [||];
DeltasOkay = [||];
for i from 0 to 30 do {
    I = [-2^(i-10);2^(i-10)];
    p = interpolate(X, q, 1b-500, I);
    if (p == q) then {
      delta = 0;
    } else {
      delta = dirtyinfnorm(p - q, I);
    };
    deltaOkay = (abs(delta) < 1b-500 * (1 + 2^(-prec+1)));
    ps = p .: ps;
    DeltasOkay = deltaOkay .: DeltasOkay;
};
ps = revert(ps);
DeltasOkay = revert(DeltasOkay);

display = hexadecimal!;
"ps = ", ps;
display = default!;

"Deltas okay: ", DeltasOkay;


/* Test #20 */
restart;
suppressmessage(171,457,57,61);
write("Test #20\n");

a = (2^100000 + 1) * 2^-100000;
b = (2^100000 + 2) * 2^-100000;

X = [| a, b |];

q = 17/42 * x;

prec = 12!;
p = interpolate(X, q);
r = interpolate(X, q, 1b-20000, [-1;1]);
prec = default!;

if (r == q) then {
  delta = 0;
} else {
  delta = max((r-q)(-1),(r-q)(1));
};

display = hexadecimal!;
write("q = ", q, "\n");
write("p = ", p, "\n");
write("r = ", r, "\n");
display = default!;
"p == q: ", p == q;
"abs(delta) <= 1b-20000: ", abs(delta) <= 1b-20000;

/* Test #21 */
restart;
suppressmessage(171,457,57,61,128,158);
write("Test #21\n");

p = interpolate([| 1, 1 |], 17 * x);
"p is error? ", ((!(p == p)) && (!(p != p)));

/* Test #22 */
restart;
suppressmessage(171,457,57,61,128,158);
write("Test #22\n");

p = interpolate([| 1, 2, 1 |], 17 * x);
"p is error? ", ((!(p == p)) && (!(p != p)));

/* Tests for interval multiplication and division */

c = [NaN;NaN] * [NaN;NaN]; 1, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [-infty;-infty]; 2, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [-infty;-7]; 3, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [-infty;0]; 4, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [-infty;7]; 5, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [-infty;infty]; 6, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [-7;-7]; 7, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [-7;0]; 8, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [-7;7]; 9, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [-7;infty]; 10, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [0;0]; 11, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [0;7]; 12, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [0;infty]; 13, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [7;7]; 14, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] * [7;infty]; 15, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [NaN;NaN]; 16, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [-infty;-infty]; 17, " ", match (c) with [infty;infty] : (true) default: (false);
c = [-infty;-infty] * [-infty;-7]; 18, " ", match (c) with [infty;infty] : (true) default: (false);
c = [-infty;-infty] * [-infty;0]; 19, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [-infty;7]; 20, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [-infty;infty]; 21, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [-7;-7]; 22, " ", match (c) with [infty;infty] : (true) default: (false);
c = [-infty;-infty] * [-7;0]; 23, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [-7;7]; 24, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [-7;infty]; 25, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [0;0]; 26, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [0;7]; 27, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [0;infty]; 28, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] * [7;7]; 29, " ", match (c) with [-infty;-infty] : (true) default: (false);
c = [-infty;-infty] * [7;infty]; 30, " ", match (c) with [-infty;-infty] : (true) default: (false);
c = [-infty;-42] * [NaN;NaN]; 31, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [-infty;-infty]; 32, " ", match (c) with [infty;infty] : (true) default: (false);
c = [-infty;-42] * [-infty;-7]; 33, " ", match (c) with [294;infty] : (true) default: (false);
c = [-infty;-42] * [-infty;0]; 34, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [-infty;7]; 35, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [-infty;infty]; 36, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [-7;-7]; 37, " ", match (c) with [294;infty] : (true) default: (false);
c = [-infty;-42] * [-7;0]; 38, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [-7;7]; 39, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [-7;infty]; 40, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [0;0]; 41, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [0;7]; 42, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [0;infty]; 43, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] * [7;7]; 44, " ", match (c) with [-infty;-294] : (true) default: (false);
c = [-infty;-42] * [7;infty]; 45, " ", match (c) with [-infty;-294] : (true) default: (false);
c = [-infty;0] * [NaN;NaN]; 46, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [-infty;-infty]; 47, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [-infty;-7]; 48, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [-infty;0]; 49, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [-infty;7]; 50, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [-infty;infty]; 51, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [-7;-7]; 52, " ", match (c) with [0;infty] : (true) default: (false);
c = [-infty;0] * [-7;0]; 53, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [-7;7]; 54, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [-7;infty]; 55, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [0;0]; 56, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [0;7]; 57, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [0;infty]; 58, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] * [7;7]; 59, " ", match (c) with [-infty;0] : (true) default: (false);
c = [-infty;0] * [7;infty]; 60, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [NaN;NaN]; 61, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [-infty;-infty]; 62, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [-infty;-7]; 63, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [-infty;0]; 64, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [-infty;7]; 65, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [-infty;infty]; 66, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [-7;-7]; 67, " ", match (c) with [-294;infty] : (true) default: (false);
c = [-infty;42] * [-7;0]; 68, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [-7;7]; 69, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [-7;infty]; 70, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [0;0]; 71, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [0;7]; 72, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [0;infty]; 73, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] * [7;7]; 74, " ", match (c) with [-infty;294] : (true) default: (false);
c = [-infty;42] * [7;infty]; 75, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [NaN;NaN]; 76, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [-infty;-infty]; 77, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [-infty;-7]; 78, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [-infty;0]; 79, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [-infty;7]; 80, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [-infty;infty]; 81, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [-7;-7]; 82, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;infty] * [-7;0]; 83, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [-7;7]; 84, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [-7;infty]; 85, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [0;0]; 86, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [0;7]; 87, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [0;infty]; 88, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] * [7;7]; 89, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;infty] * [7;infty]; 90, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;-42] * [NaN;NaN]; 91, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;-42] * [-infty;-infty]; 92, " ", match (c) with [infty;infty] : (true) default: (false);
c = [-42;-42] * [-infty;-7]; 93, " ", match (c) with [294;infty] : (true) default: (false);
c = [-42;-42] * [-infty;0]; 94, " ", match (c) with [0;infty] : (true) default: (false);
c = [-42;-42] * [-infty;7]; 95, " ", match (c) with [-294;infty] : (true) default: (false);
c = [-42;-42] * [-infty;infty]; 96, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] * [-7;-7]; 97, " ", match (c) with [294;294] : (true) default: (false);
c = [-42;-42] * [-7;0]; 98, " ", match (c) with [0;294] : (true) default: (false);
c = [-42;-42] * [-7;7]; 99, " ", match (c) with [-294;294] : (true) default: (false);
c = [-42;-42] * [-7;infty]; 100, " ", match (c) with [-infty;294] : (true) default: (false);
c = [-42;-42] * [0;0]; 101, " ", match (c) with [0;0] : (true) default: (false);
c = [-42;-42] * [0;7]; 102, " ", match (c) with [-294;0] : (true) default: (false);
c = [-42;-42] * [0;infty]; 103, " ", match (c) with [-infty;0] : (true) default: (false);
c = [-42;-42] * [7;7]; 104, " ", match (c) with [-294;-294] : (true) default: (false);
c = [-42;-42] * [7;infty]; 105, " ", match (c) with [-infty;-294] : (true) default: (false);
c = [-42;0] * [NaN;NaN]; 106, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] * [-infty;-infty]; 107, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] * [-infty;-7]; 108, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] * [-infty;0]; 109, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] * [-infty;7]; 110, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] * [-infty;infty]; 111, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] * [-7;-7]; 112, " ", match (c) with [0;294] : (true) default: (false);
c = [-42;0] * [-7;0]; 113, " ", match (c) with [0;294] : (true) default: (false);
c = [-42;0] * [-7;7]; 114, " ", match (c) with [-294;294] : (true) default: (false);
c = [-42;0] * [-7;infty]; 115, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] * [0;0]; 116, " ", match (c) with [0;0] : (true) default: (false);
c = [-42;0] * [0;7]; 117, " ", match (c) with [-294;0] : (true) default: (false);
c = [-42;0] * [0;infty]; 118, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] * [7;7]; 119, " ", match (c) with [-294;0] : (true) default: (false);
c = [-42;0] * [7;infty]; 120, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] * [NaN;NaN]; 121, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] * [-infty;-infty]; 122, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] * [-infty;-7]; 123, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] * [-infty;0]; 124, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] * [-infty;7]; 125, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] * [-infty;infty]; 126, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] * [-7;-7]; 127, " ", match (c) with [-294;294] : (true) default: (false);
c = [-42;42] * [-7;0]; 128, " ", match (c) with [-294;294] : (true) default: (false);
c = [-42;42] * [-7;7]; 129, " ", match (c) with [-294;294] : (true) default: (false);
c = [-42;42] * [-7;infty]; 130, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] * [0;0]; 131, " ", match (c) with [0;0] : (true) default: (false);
c = [-42;42] * [0;7]; 132, " ", match (c) with [-294;294] : (true) default: (false);
c = [-42;42] * [0;infty]; 133, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] * [7;7]; 134, " ", match (c) with [-294;294] : (true) default: (false);
c = [-42;42] * [7;infty]; 135, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [NaN;NaN]; 136, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [-infty;-infty]; 137, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [-infty;-7]; 138, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [-infty;0]; 139, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [-infty;7]; 140, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [-infty;infty]; 141, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [-7;-7]; 142, " ", match (c) with [-infty;294] : (true) default: (false);
c = [-42;infty] * [-7;0]; 143, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [-7;7]; 144, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [-7;infty]; 145, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [0;0]; 146, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [0;7]; 147, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [0;infty]; 148, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] * [7;7]; 149, " ", match (c) with [-294;infty] : (true) default: (false);
c = [-42;infty] * [7;infty]; 150, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] * [NaN;NaN]; 151, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] * [-infty;-infty]; 152, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] * [-infty;-7]; 153, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] * [-infty;0]; 154, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] * [-infty;7]; 155, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] * [-infty;infty]; 156, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] * [-7;-7]; 157, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] * [-7;0]; 158, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] * [-7;7]; 159, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] * [-7;infty]; 160, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] * [0;0]; 161, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] * [0;7]; 162, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] * [0;infty]; 163, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] * [7;7]; 164, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] * [7;infty]; 165, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] * [NaN;NaN]; 166, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] * [-infty;-infty]; 167, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] * [-infty;-7]; 168, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] * [-infty;0]; 169, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] * [-infty;7]; 170, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] * [-infty;infty]; 171, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] * [-7;-7]; 172, " ", match (c) with [-294;0] : (true) default: (false);
c = [0;42] * [-7;0]; 173, " ", match (c) with [-294;0] : (true) default: (false);
c = [0;42] * [-7;7]; 174, " ", match (c) with [-294;294] : (true) default: (false);
c = [0;42] * [-7;infty]; 175, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] * [0;0]; 176, " ", match (c) with [0;0] : (true) default: (false);
c = [0;42] * [0;7]; 177, " ", match (c) with [0;294] : (true) default: (false);
c = [0;42] * [0;infty]; 178, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] * [7;7]; 179, " ", match (c) with [0;294] : (true) default: (false);
c = [0;42] * [7;infty]; 180, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [NaN;NaN]; 181, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [-infty;-infty]; 182, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [-infty;-7]; 183, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [-infty;0]; 184, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [-infty;7]; 185, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [-infty;infty]; 186, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [-7;-7]; 187, " ", match (c) with [-infty;0] : (true) default: (false);
c = [0;infty] * [-7;0]; 188, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [-7;7]; 189, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [-7;infty]; 190, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [0;0]; 191, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [0;7]; 192, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [0;infty]; 193, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] * [7;7]; 194, " ", match (c) with [0;infty] : (true) default: (false);
c = [0;infty] * [7;infty]; 195, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;42] * [NaN;NaN]; 196, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;42] * [-infty;-infty]; 197, " ", match (c) with [-infty;-infty] : (true) default: (false);
c = [42;42] * [-infty;-7]; 198, " ", match (c) with [-infty;-294] : (true) default: (false);
c = [42;42] * [-infty;0]; 199, " ", match (c) with [-infty;0] : (true) default: (false);
c = [42;42] * [-infty;7]; 200, " ", match (c) with [-infty;294] : (true) default: (false);
c = [42;42] * [-infty;infty]; 201, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] * [-7;-7]; 202, " ", match (c) with [-294;-294] : (true) default: (false);
c = [42;42] * [-7;0]; 203, " ", match (c) with [-294;0] : (true) default: (false);
c = [42;42] * [-7;7]; 204, " ", match (c) with [-294;294] : (true) default: (false);
c = [42;42] * [-7;infty]; 205, " ", match (c) with [-294;infty] : (true) default: (false);
c = [42;42] * [0;0]; 206, " ", match (c) with [0;0] : (true) default: (false);
c = [42;42] * [0;7]; 207, " ", match (c) with [0;294] : (true) default: (false);
c = [42;42] * [0;infty]; 208, " ", match (c) with [0;infty] : (true) default: (false);
c = [42;42] * [7;7]; 209, " ", match (c) with [294;294] : (true) default: (false);
c = [42;42] * [7;infty]; 210, " ", match (c) with [294;infty] : (true) default: (false);
c = [42;infty] * [NaN;NaN]; 211, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [-infty;-infty]; 212, " ", match (c) with [-infty;-infty] : (true) default: (false);
c = [42;infty] * [-infty;-7]; 213, " ", match (c) with [-infty;-294] : (true) default: (false);
c = [42;infty] * [-infty;0]; 214, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [-infty;7]; 215, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [-infty;infty]; 216, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [-7;-7]; 217, " ", match (c) with [-infty;-294] : (true) default: (false);
c = [42;infty] * [-7;0]; 218, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [-7;7]; 219, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [-7;infty]; 220, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [0;0]; 221, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [0;7]; 222, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [0;infty]; 223, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] * [7;7]; 224, " ", match (c) with [294;infty] : (true) default: (false);
c = [42;infty] * [7;infty]; 225, " ", match (c) with [294;infty] : (true) default: (false);
c = [NaN;NaN] / [NaN;NaN]; 226, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [-infty;-infty]; 227, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [-infty;-7]; 228, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [-infty;0]; 229, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [-infty;7]; 230, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [-infty;infty]; 231, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [-7;-7]; 232, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [-7;0]; 233, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [-7;7]; 234, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [-7;infty]; 235, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [0;0]; 236, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [0;7]; 237, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [0;infty]; 238, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [7;7]; 239, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [NaN;NaN] / [7;infty]; 240, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] / [NaN;NaN]; 241, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] / [-infty;-infty]; 242, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] / [-infty;-7]; 243, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] / [-infty;0]; 244, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] / [-infty;7]; 245, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] / [-infty;infty]; 246, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] / [-7;-7]; 247, " ", match (c) with [infty;infty] : (true) default: (false);
c = [-infty;-infty] / [-7;0]; 248, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;-infty] / [-7;7]; 249, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;-infty] / [-7;infty]; 250, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] / [0;0]; 251, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;-infty] / [0;7]; 252, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;-infty] / [0;infty]; 253, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-infty] / [7;7]; 254, " ", match (c) with [-infty;-infty] : (true) default: (false);
c = [-infty;-infty] / [7;infty]; 255, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] / [NaN;NaN]; 256, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] / [-infty;-infty]; 257, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] / [-infty;-7]; 258, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] / [-infty;0]; 259, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] / [-infty;7]; 260, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] / [-infty;infty]; 261, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] / [-7;-7]; 262, " ", match (c) with [6;infty] : (true) default: (false);
c = [-infty;-42] / [-7;0]; 263, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;-42] / [-7;7]; 264, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;-42] / [-7;infty]; 265, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] / [0;0]; 266, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;-42] / [0;7]; 267, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;-42] / [0;infty]; 268, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;-42] / [7;7]; 269, " ", match (c) with [-infty;-6] : (true) default: (false);
c = [-infty;-42] / [7;infty]; 270, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [NaN;NaN]; 271, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [-infty;-infty]; 272, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [-infty;-7]; 273, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [-infty;0]; 274, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [-infty;7]; 275, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [-infty;infty]; 276, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [-7;-7]; 277, " ", match (c) with [0;infty] : (true) default: (false);
c = [-infty;0] / [-7;0]; 278, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [-7;7]; 279, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [-7;infty]; 280, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [0;0]; 281, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [0;7]; 282, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [0;infty]; 283, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;0] / [7;7]; 284, " ", match (c) with [-infty;0] : (true) default: (false);
c = [-infty;0] / [7;infty]; 285, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [NaN;NaN]; 286, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [-infty;-infty]; 287, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [-infty;-7]; 288, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [-infty;0]; 289, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [-infty;7]; 290, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [-infty;infty]; 291, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [-7;-7]; 292, " ", match (c) with [-6;infty] : (true) default: (false);
c = [-infty;42] / [-7;0]; 293, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [-7;7]; 294, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [-7;infty]; 295, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [0;0]; 296, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [0;7]; 297, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [0;infty]; 298, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;42] / [7;7]; 299, " ", match (c) with [-infty;6] : (true) default: (false);
c = [-infty;42] / [7;infty]; 300, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [NaN;NaN]; 301, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [-infty;-infty]; 302, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [-infty;-7]; 303, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [-infty;0]; 304, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [-infty;7]; 305, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [-infty;infty]; 306, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [-7;-7]; 307, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;infty] / [-7;0]; 308, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [-7;7]; 309, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [-7;infty]; 310, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [0;0]; 311, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [0;7]; 312, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [0;infty]; 313, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-infty;infty] / [7;7]; 314, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-infty;infty] / [7;infty]; 315, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;-42] / [NaN;NaN]; 316, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;-42] / [-infty;-infty]; 317, " ", match (c) with [0;0] : (true) default: (false);
c = [-42;-42] / [-infty;-7]; 318, " ", match (c) with [0;6] : (true) default: (false);
c = [-42;-42] / [-infty;0]; 319, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] / [-infty;7]; 320, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] / [-infty;infty]; 321, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] / [-7;-7]; 322, " ", match (c) with [6;6] : (true) default: (false);
c = [-42;-42] / [-7;0]; 323, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] / [-7;7]; 324, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] / [-7;infty]; 325, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] / [0;0]; 326, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] / [0;7]; 327, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] / [0;infty]; 328, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [-42;-42] / [7;7]; 329, " ", match (c) with [-6;-6] : (true) default: (false);
c = [-42;-42] / [7;infty]; 330, " ", match (c) with [-6;0] : (true) default: (false);
c = [-42;0] / [NaN;NaN]; 331, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [-infty;-infty]; 332, " ", match (c) with [0;0] : (true) default: (false);
c = [-42;0] / [-infty;-7]; 333, " ", match (c) with [0;6] : (true) default: (false);
c = [-42;0] / [-infty;0]; 334, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [-infty;7]; 335, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [-infty;infty]; 336, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [-7;-7]; 337, " ", match (c) with [0;6] : (true) default: (false);
c = [-42;0] / [-7;0]; 338, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [-7;7]; 339, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [-7;infty]; 340, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [0;0]; 341, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [0;7]; 342, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [0;infty]; 343, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;0] / [7;7]; 344, " ", match (c) with [-6;0] : (true) default: (false);
c = [-42;0] / [7;infty]; 345, " ", match (c) with [-6;0] : (true) default: (false);
c = [-42;42] / [NaN;NaN]; 346, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [-infty;-infty]; 347, " ", match (c) with [0;0] : (true) default: (false);
c = [-42;42] / [-infty;-7]; 348, " ", match (c) with [-6;6] : (true) default: (false);
c = [-42;42] / [-infty;0]; 349, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [-infty;7]; 350, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [-infty;infty]; 351, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [-7;-7]; 352, " ", match (c) with [-6;6] : (true) default: (false);
c = [-42;42] / [-7;0]; 353, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [-7;7]; 354, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [-7;infty]; 355, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [0;0]; 356, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [0;7]; 357, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [0;infty]; 358, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;42] / [7;7]; 359, " ", match (c) with [-6;6] : (true) default: (false);
c = [-42;42] / [7;infty]; 360, " ", match (c) with [-6;6] : (true) default: (false);
c = [-42;infty] / [NaN;NaN]; 361, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [-infty;-infty]; 362, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [-infty;-7]; 363, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [-infty;0]; 364, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [-infty;7]; 365, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [-infty;infty]; 366, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [-7;-7]; 367, " ", match (c) with [-infty;6] : (true) default: (false);
c = [-42;infty] / [-7;0]; 368, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [-7;7]; 369, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [-7;infty]; 370, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [0;0]; 371, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [0;7]; 372, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [0;infty]; 373, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [-42;infty] / [7;7]; 374, " ", match (c) with [-6;infty] : (true) default: (false);
c = [-42;infty] / [7;infty]; 375, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [NaN;NaN]; 376, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [-infty;-infty]; 377, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] / [-infty;-7]; 378, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] / [-infty;0]; 379, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [-infty;7]; 380, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [-infty;infty]; 381, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [-7;-7]; 382, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] / [-7;0]; 383, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [-7;7]; 384, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [-7;infty]; 385, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [0;0]; 386, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [0;7]; 387, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [0;infty]; 388, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;0] / [7;7]; 389, " ", match (c) with [0;0] : (true) default: (false);
c = [0;0] / [7;infty]; 390, " ", match (c) with [0;0] : (true) default: (false);
c = [0;42] / [NaN;NaN]; 391, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [-infty;-infty]; 392, " ", match (c) with [0;0] : (true) default: (false);
c = [0;42] / [-infty;-7]; 393, " ", match (c) with [-6;0] : (true) default: (false);
c = [0;42] / [-infty;0]; 394, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [-infty;7]; 395, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [-infty;infty]; 396, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [-7;-7]; 397, " ", match (c) with [-6;0] : (true) default: (false);
c = [0;42] / [-7;0]; 398, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [-7;7]; 399, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [-7;infty]; 400, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [0;0]; 401, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [0;7]; 402, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [0;infty]; 403, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;42] / [7;7]; 404, " ", match (c) with [0;6] : (true) default: (false);
c = [0;42] / [7;infty]; 405, " ", match (c) with [0;6] : (true) default: (false);
c = [0;infty] / [NaN;NaN]; 406, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [-infty;-infty]; 407, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [-infty;-7]; 408, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [-infty;0]; 409, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [-infty;7]; 410, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [-infty;infty]; 411, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [-7;-7]; 412, " ", match (c) with [-infty;0] : (true) default: (false);
c = [0;infty] / [-7;0]; 413, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [-7;7]; 414, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [-7;infty]; 415, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [0;0]; 416, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [0;7]; 417, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [0;infty]; 418, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [0;infty] / [7;7]; 419, " ", match (c) with [0;infty] : (true) default: (false);
c = [0;infty] / [7;infty]; 420, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;42] / [NaN;NaN]; 421, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;42] / [-infty;-infty]; 422, " ", match (c) with [0;0] : (true) default: (false);
c = [42;42] / [-infty;-7]; 423, " ", match (c) with [-6;0] : (true) default: (false);
c = [42;42] / [-infty;0]; 424, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] / [-infty;7]; 425, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] / [-infty;infty]; 426, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] / [-7;-7]; 427, " ", match (c) with [-6;-6] : (true) default: (false);
c = [42;42] / [-7;0]; 428, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] / [-7;7]; 429, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] / [-7;infty]; 430, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] / [0;0]; 431, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] / [0;7]; 432, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] / [0;infty]; 433, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;42] / [7;7]; 434, " ", match (c) with [6;6] : (true) default: (false);
c = [42;42] / [7;infty]; 435, " ", match (c) with [0;6] : (true) default: (false);
c = [42;infty] / [NaN;NaN]; 436, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] / [-infty;-infty]; 437, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] / [-infty;-7]; 438, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] / [-infty;0]; 439, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] / [-infty;7]; 440, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] / [-infty;infty]; 441, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] / [-7;-7]; 442, " ", match (c) with [-infty;-6] : (true) default: (false);
c = [42;infty] / [-7;0]; 443, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;infty] / [-7;7]; 444, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;infty] / [-7;infty]; 445, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] / [0;0]; 446, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;infty] / [0;7]; 447, " ", match (c) with [-infty;infty] : (true) default: (false);
c = [42;infty] / [0;infty]; 448, " ", match (c) with [NaN;NaN] : (true) default: (false);
c = [42;infty] / [7;7]; 449, " ", match (c) with [6;infty] : (true) default: (false);
c = [42;infty] / [7;infty]; 450, " ", match (c) with [NaN;NaN] : (true) default: (false);




/* Tests for gcd and bezout */

restart;

factors_elements = [| 3, 5, 7, 11, 13, (_x_ - 1), (_x_ - 2), (_x_ - 3)^2, (_x_ - 4)^3, (_x_ - 5)^3 |];

tsts = [||];

for a in factors_elements do {
    for b in factors_elements do {
        tt = horner(a * b);
	tsts = tt .: tsts;
    };
};

okay = true;
i = 0;
for a in tsts do {
    for b in tsts do {
        i = i + 1;
    	g = gcd(a, b);
	bz = bezout(a, b);
	gbz = bz.g;
	rbz = bz.r;
	ubz = bz.a;
	vbz = bz.b;
	if (rbz == 0) then {
	   if (gbz == g) then {
	      gg = ubz * a + vbz * b;
	      if (gg == g) then {
	      	 rma = mod(a, g);
		 rmb = mod(b, g);
		 if ((rma != 0) || (rmb != 0)) then {
	      	    write("i = ", i, ": bezout(", a, ", ", b, ") = ", bz, ", gcd(", a, ", ", b, ") = ", g, "\n");
	      	    okay = false;	      	 
		 };
	      } else {
	      	 write("i = ", i, ": bezout(", a, ", ", b, ") = ", bz, ", gcd(", a, ", ", b, ") = ", g, "\n");
	      	 okay = false;	      	 
	      };
	   } else {
	      write("i = ", i, ": bezout(", a, ", ", b, ") = ", bz, ", gcd(", a, ", ", b, ") = ", g, "\n");
	      okay = false;
	   };
	} else {
	   write("i = ", i, ": bezout(", a, ", ", b, ") = ", bz, ", gcd(", a, ", ", b, ") = ", g, "\n");
	   okay = false;
	};
    };
};

if (okay) then {
   write("All ", i, " tests for gcd() and bezout() are okay.\n");
};


/* New tests for dirtyfindzeros */
restart;

roundingwarnings = off!;

procedure generate_unevaluable_at(x0) {
	  var c, f;

	  f = abs(_x_) / _x_;

	  if (x0 == 0) then {
	     c = 1;
	  } else {
	     c = x0/points;
	  };

	  return c * f(_x_ - x0);
};

procedure generate_hopital_zero_at(x0) {
	  var c, f;

	  f = (sin(_x_) - _x_) / _x_;

	  if (x0 == 0) then {
	     c = 1;
	  } else {
	     c = x0/points;
	  };

	  return c * f(_x_ - x0);
};

procedure generate_zero_at(x0) {
	  var c, f;

	  f = tanh(_x_);

	  if (x0 == 0) then {
	     c = 1;
	  } else {
	     c = x0/points;
	  };

	  return c * f(_x_ - x0);
};

procedure generate_no_zero_at(x0) {
	  var c, f;

	  f = 2 + atan(_x_);

	  if (x0 == 0) then {
	     c = 1;
	  } else {
	     c = x0/points;
	  };

	  return c * f(_x_ - x0);
};

f = 1;
n = 15;
for i from 0 to n-1 do {
    f = f * (match (mod(i, 4)) with
      	     	   0 : (generate_no_zero_at(nearestint(i/n * points)))
		   1 : (generate_zero_at(nearestint(i/n * points)))
		   2 : (generate_hopital_zero_at(nearestint(i/n * points)))
		   3 : (generate_unevaluable_at(nearestint(i/n * points))));
};

zeros = dirtyfindzeros(f, [0; points]);

MY = 0;
for z in zeros do {
    X = z;
    Y := f(z);
    MY = max(MY, abs(Y));
    write("X = ", X, ", Y = ", Y, "\n");
};
write("maximum |Y|: ", MY, "\n");

