aboutsummaryrefslogtreecommitdiff
path: root/stdlib/tst-strtod.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-19 09:06:14 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-19 09:06:14 +0000
commitb5f7b1192580309fd638feaa8bbc99f8f73d366f (patch)
tree0552d0d36959b2e23abbc74c313e68e3b33637da /stdlib/tst-strtod.c
parent1c5247109d620c17e16b645d8356b50355065a12 (diff)
downloadglibc-b5f7b1192580309fd638feaa8bbc99f8f73d366f.zip
glibc-b5f7b1192580309fd638feaa8bbc99f8f73d366f.tar.gz
glibc-b5f7b1192580309fd638feaa8bbc99f8f73d366f.tar.bz2
Update.
* stdlib/tst-strtod.c (main): Add test for strtof bug.
Diffstat (limited to 'stdlib/tst-strtod.c')
-rw-r--r--stdlib/tst-strtod.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c
index afd522b..9496c3d 100644
--- a/stdlib/tst-strtod.c
+++ b/stdlib/tst-strtod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991,96,97,98,99,2000,2001,2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -125,6 +125,29 @@ main (int argc, char ** argv)
status = 1;
}
+ const char input[] = "3752432815e-39";
+
+ float f1 = strtold (input, NULL);
+ float f2;
+ float f3 = strtof (input, NULL);
+ sscanf (input, "%g", &f2);
+
+ if (f1 != f2)
+ {
+ printf ("f1 = %a != f2 = %a\n", f1, f2);
+ status = 1;
+ }
+ if (f1 != f3)
+ {
+ printf ("f1 = %a != f3 = %a\n", f1, f3);
+ status = 1;
+ }
+ if (f2 != f3)
+ {
+ printf ("f2 = %a != f3 = %a\n", f2, f3);
+ status = 1;
+ }
+
status |= long_dbl ();
status |= locale_test ();