https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847
--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Mon, Jul 21, 2014 at 06:18:14PM +0000, e2cd58e1 at opayq dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847 > > --- Comment #7 from e2cd58e1 at opayq dot com --- > For > > printf("Test 1 = %.4f\n",strtod("1.2345",NULL)); > printf("Test 2 = %.4f\n",strtod("1,2345",NULL)); > > I get > > Test 1 = 1,0000 > Test 2 = 1,2345 > That's what I would expect. Here's another test; #include <locale.h> #include <stdio.h> #include <stdlib.h> int main(void) { char *s1 = "1.2345", *s2 = "5,4321"; double d1, d2; setlocale(LC_ALL, "en_US.ISO8859-1"); d1 = strtod(s1, NULL); d2 = strtod(s2, NULL); printf("%s = %.4lf and %s = %.4lf\n", s1, d1, s2, d2); setlocale(LC_ALL, "de_DE.UTF-8"); d1 = strtod(s1, NULL); d2 = strtod(s2, NULL); printf("%s = %.4lf and %s = %.4lf\n", s1, d1, s2, d2); return 0; } I get troutmask:sgk[204] ./z 1.2345 = 1.2345 and 5,4321 = 5.0000 1.2345 = 1,0000 and 5,4321 = 5,4321 So, the section of code that I posted in comment 6 is ensuring that the fraction separator is always a decimal point, and your locale and strtod are expecting a comma.