Bug 1230

Summary: INF not accepted by strtod in Turkish locales (tr_TR.iso88599)
Product: glibc Reporter: Vincent Lefèvre <vincent-srcware>
Component: libcAssignee: GOTO Masanori <gotom>
Severity: normal CC: glibc-bugs
Priority: P2 Flags: fweimer: security-
Version: 2.3.5   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Vincent Lefèvre 2005-08-22 22:28:50 UTC
The ISO C standard requires "INF" to be accepted by strtod:

         -- one of INF or INFINITY, ignoring case

But in Turkish locales (LC_ALL=tr_TR.iso88599), where the lowercase 'I' is the
dotless 'i', "INF" (or similar) is not recognized as the infinity. This can be
seen with the following program and LC_ALL="tr_TR.iso88599". Tested under Debian
with the libc6 2.3.5-4 package.

#include <stdio.h>
#include <stdlib.h>
#include <locale.h>

int main (void)
  double x;
  char *end;
  int err;

  if (setlocale (LC_ALL, "") == NULL)
      fprintf (stderr, "Can't set locales\n");
      exit (EXIT_FAILURE);

  x = strtod ("INF", &end);
  err = *end != '\0';
  printf ("x = %f - error: %s\n", x, err ? "yes" : "no");

  return err;
Comment 1 Ulrich Drepper 2005-09-28 06:08:35 UTC
Fixed in the current CVS trunk version.