This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/5774] New: some strtod() cases are wrong


Observe the following code:

volta$ cat strtod-test.c
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
  double d;
  char *endp;
  char *s = argv[1];
  if (argc != 2)
  {
    printf("Usage: %s string\n", argv[0]);
    return 1;
  }
  d = strtod(s, &endp);
  printf("Got value %g, string tail %s\n", d, endp);
  return 0;
}

volta$ ./strtod-test 'Nan(anana)ana'
Got value nan, string tail )ana

According to ISO C99 7.20.1.3 para 3, the trailing ')' is also part of the 
expected form in the NAN(n-char-seq-opt). Therefore the result should be 'ana'.

-- 
           Summary: some strtod() cases are wrong
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: aurelien at aurel32 dot net
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=5774

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]