Fix a few of the tests so that correct implementations actually pass them.

This commit is contained in:
das 2007-01-07 09:25:22 +00:00
parent 3ef4cfecda
commit 8fda45acae

View File

@ -100,11 +100,15 @@ test_invalid(double x, double y)
assert(isnan(remainder(x, y)));
assert(isnan(remquo(x, y, &q)));
#ifdef STRICT
assert(q == 0xdeadbeef);
#endif
assert(isnan(remainderf(x, y)));
assert(isnan(remquof(x, y, &q)));
#ifdef STRICT
assert(q == 0xdeadbeef);
#endif
}
/* 0x012345 ==> 0x01ffff */
@ -123,9 +127,11 @@ testd(double x, double y, double expected_rem, int expected_quo)
assert(remainder(x, y) == expected_rem);
assert(remquo(x, y, &q) == expected_rem);
assert((q & 0x7) == (expected_quo & 0x7));
assert((q > 0) ^ !(expected_quo > 0));
q = abs(q);
assert((q & mask(q)) == (abs(expected_quo) & mask(q)));
if (q != 0) {
assert((q > 0) ^ !(expected_quo > 0));
q = abs(q);
assert(q == (abs(expected_quo) & mask(q)));
}
}
static void
@ -137,7 +143,9 @@ testf(float x, float y, float expected_rem, int expected_quo)
assert(remainderf(x, y) == expected_rem);
assert(remquof(x, y, &q) == expected_rem);
assert((q & 0x7) == (expected_quo & 0x7));
assert((q > 0) ^ !(expected_quo > 0));
q = abs(q);
assert((q & mask(q)) == (abs(expected_quo) & mask(q)));
if (q != 0) {
assert((q > 0) ^ !(expected_quo > 0));
q = abs(q);
assert((q & mask(q)) == (abs(expected_quo) & mask(q)));
}
}