summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-05-12 15:10:05 -0400
committerRich Felker <dalias@aerifal.cx>2011-05-12 15:10:05 -0400
commit51301ea856288510abd0fbdcb4aa5623ca6c8472 (patch)
tree0bad12c2ed057185ffa7732b99491dffe9500c8f
parentccd91362dd6db79e1e652f2858ff8750a35192ff (diff)
downloadlibc-testsuite-51301ea856288510abd0fbdcb4aa5623ca6c8472.tar.gz
add some printf float rounding tests
-rw-r--r--config.mak1
-rw-r--r--snprintf.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/config.mak b/config.mak
index 7be2b3a..6930dd1 100644
--- a/config.mak
+++ b/config.mak
@@ -1,3 +1,4 @@
CFLAGS += -Wall -Wno-overflow -Wno-unused -Wno-format
CFLAGS += -DHAVE_BSD_STRL
CFLAGS += -DDISABLE_SLOW_TESTS
+#LDFLAGS += -L/home/dalias/musl-test/lib
diff --git a/snprintf.c b/snprintf.c
index 79ec1cc..1468974 100644
--- a/snprintf.c
+++ b/snprintf.c
@@ -69,6 +69,14 @@ static const struct {
{ "%.4f", 1.06125, "1.0612" },
{ "%.2f", 1.375, "1.38" },
{ "%.1f", 1.375, "1.4" },
+ { "%.15f", 1.1, "1.100000000000000" },
+ { "%.16f", 1.1, "1.1000000000000001" },
+ { "%.17f", 1.1, "1.10000000000000009" },
+ { "%.2e", 1500001.0, "1.50e+06" },
+ { "%.2e", 1505000.0, "1.50e+06" },
+ { "%.2e", 1505000.00000095367431640625, "1.51e+06" },
+ { "%.2e", 1505001.0, "1.51e+06" },
+ { "%.2e", 1506000.0, "1.51e+06" },
/* correctness in DBL_DIG places */
{ "%.15g", 1.23456789012345, "1.23456789012345" },