From owner-svn-src-all@FreeBSD.ORG Sat Apr 7 04:00:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E480E1065673; Sat, 7 Apr 2012 04:00:30 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C62DD8FC1F; Sat, 7 Apr 2012 04:00:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3740U4o041025; Sat, 7 Apr 2012 04:00:30 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3740UCK041023; Sat, 7 Apr 2012 04:00:30 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201204070400.q3740UCK041023@svn.freebsd.org> From: David Schultz Date: Sat, 7 Apr 2012 04:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233974 - head/tools/regression/lib/msun X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2012 04:00:31 -0000 Author: das Date: Sat Apr 7 04:00:30 2012 New Revision: 233974 URL: http://svn.freebsd.org/changeset/base/233974 Log: Add some tests from PR 166463. Also make sure that all of the tests, old and new, check the sign bits of both the remainder and the quotient. Modified: head/tools/regression/lib/msun/test-rem.c Modified: head/tools/regression/lib/msun/test-rem.c ============================================================================== --- head/tools/regression/lib/msun/test-rem.c Sat Apr 7 03:59:12 2012 (r233973) +++ head/tools/regression/lib/msun/test-rem.c Sat Apr 7 04:00:30 2012 (r233974) @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) { - printf("1..2\n"); + printf("1..3\n"); test_invalid(0.0, 0.0); test_invalid(1.0, 0.0); @@ -96,6 +96,14 @@ main(int argc, char *argv[]) printf("ok 2 - rem\n"); + test(0x1.66666cp+120, 0x1p+71, 0.0, 1476395008); + testd(-0x1.0000000000003p+0, 0x1.0000000000003p+0, -0.0, -1); + testl(-0x1.0000000000003p+0, 0x1.0000000000003p+0, -0.0, -1); + testd(-0x1.0000000000001p-749, 0x1.4p-1072, 0x1p-1074, -1288490189); + testl(-0x1.0000000000001p-749, 0x1.4p-1072, 0x1p-1074, -1288490189); + + printf("ok 3 - rem\n"); + return (0); } @@ -136,10 +144,16 @@ static void testl(long double x, long double y, long double expected_rem, int expected_quo) { int q; + long double rem; q = random(); - assert(remainderl(x, y) == expected_rem); - assert(remquol(x, y, &q) == expected_rem); + rem = remainderl(x, y); + assert(rem == expected_rem); + assert(!signbit(rem) == !signbit(expected_rem)); + rem = remquol(x, y, &q); + assert(rem == expected_rem); + assert(!signbit(rem) == !signbit(expected_rem)); + assert((q ^ expected_quo) >= 0); /* sign(q) == sign(expected_quo) */ assert((q & 0x7) == (expected_quo & 0x7)); if (q != 0) { assert((q > 0) ^ !(expected_quo > 0)); @@ -152,10 +166,16 @@ static void testd(double x, double y, double expected_rem, int expected_quo) { int q; + double rem; q = random(); - assert(remainder(x, y) == expected_rem); - assert(remquo(x, y, &q) == expected_rem); + rem = remainder(x, y); + assert(rem == expected_rem); + assert(!signbit(rem) == !signbit(expected_rem)); + rem = remquo(x, y, &q); + assert(rem == expected_rem); + assert(!signbit(rem) == !signbit(expected_rem)); + assert((q ^ expected_quo) >= 0); /* sign(q) == sign(expected_quo) */ assert((q & 0x7) == (expected_quo & 0x7)); if (q != 0) { assert((q > 0) ^ !(expected_quo > 0)); @@ -168,10 +188,16 @@ static void testf(float x, float y, float expected_rem, int expected_quo) { int q; + float rem; q = random(); - assert(remainderf(x, y) == expected_rem); - assert(remquof(x, y, &q) == expected_rem); + rem = remainderf(x, y); + assert(rem == expected_rem); + assert(!signbit(rem) == !signbit(expected_rem)); + rem = remquof(x, y, &q); + assert(rem == expected_rem); + assert(!signbit(rem) == !signbit(expected_rem)); + assert((q ^ expected_quo) >= 0); /* sign(q) == sign(expected_quo) */ assert((q & 0x7) == (expected_quo & 0x7)); if (q != 0) { assert((q > 0) ^ !(expected_quo > 0));