diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2010-09-18 17:24:11 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2010-09-18 17:24:11 +0000 |
commit | e339f3e86268642b67bfed8f14a50785f51cf9f4 (patch) | |
tree | 78b24949cfffa546d8b62368af4eed84ecb8bc44 | |
parent | d15c42cea6997fafd5d6f9beed5355905ed26d2d (diff) |
Test default precision when ndigit is negative.
-rw-r--r-- | regress/lib/libc/gcvt/gcvt_test.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/regress/lib/libc/gcvt/gcvt_test.c b/regress/lib/libc/gcvt/gcvt_test.c index b976a7dfe6d..aed34e3d585 100644 --- a/regress/lib/libc/gcvt/gcvt_test.c +++ b/regress/lib/libc/gcvt/gcvt_test.c @@ -37,6 +37,7 @@ static struct test_vector { { 1.0, 0, "1" }, { 1.0, 2, "1" }, { 1.0, 10, "1" }, + { 1.236, -1, "1.236" }, { 1.236, 0, "1" }, { 1.236, 1, "1" }, { 1.236, 2, "1.2" }, @@ -44,6 +45,7 @@ static struct test_vector { { 1.236, 4, "1.236" }, { 1.236, 5, "1.236" }, { 1.236, 6, "1.236" }, + { 12.36, -1, "12.36" }, { 12.36, 0, "1e+01" }, { 12.36, 1, "1e+01" }, { 12.36, 2, "12" }, @@ -51,6 +53,7 @@ static struct test_vector { { 12.36, 4, "12.36" }, { 12.36, 5, "12.36" }, { 12.36, 6, "12.36" }, + { 123.6, -1, "123.6" }, { 123.6, 0, "1e+02" }, { 123.6, 1, "1e+02" }, { 123.6, 2, "1.2e+02" }, @@ -58,6 +61,7 @@ static struct test_vector { { 123.6, 4, "123.6" }, { 123.6, 5, "123.6" }, { 123.6, 6, "123.6" }, + { 1236.0, -1, "1236" }, { 1236.0, 0, "1e+03" }, { 1236.0, 1, "1e+03" }, { 1236.0, 2, "1.2e+03" }, @@ -67,12 +71,14 @@ static struct test_vector { { 1236.0, 6, "1236" }, { 1e100, 10, "1e+100" }, { 1e100, 20, "1.0000000000000000159e+100" }, + { 0.01236, -1, "0.01236" }, { 0.01236, 0, "0.01" }, { 0.01236, 1, "0.01" }, { 0.01236, 2, "0.012" }, { 0.01236, 3, "0.0124" }, { 0.01236, 4, "0.01236" }, { 1e-100, 20, "1.00000000000000002e-100" }, + { 1e-100, -1, "1e-100" }, { -1.2, 5, "-1.2" }, { -0.03, 5, "-0.03" }, { 0.1, 1, "0.1" }, |