Bug 24855 - Localization should not be done by fprintf()
Summary: Localization should not be done by fprintf()
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: glibc
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Aaron Brown
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-01-24 16:01 UTC by Enrico Scholz
Modified: 2016-11-24 15:11 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2001-01-24 16:01:20 UTC


Attachments (Terms of Use)

Description Enrico Scholz 2001-01-24 16:01:17 UTC
The follwing program gives different output in different languages:

------ fp.c --------
#include <stdio.h>
#include <locale.h>

int main()
{
        setlocale (LC_ALL, "");
        printf("%f\n", 42.0);
}
-----------------

$ gcc -std=c99 ~/tmp/fp.c
$ LANG=C ./a.out 
42.000000
$ LANG=de_DE ./a.out 
42,000000


The C99-draft says at 7.19.6.1/#8:

-------------------
f,F     A  double argument representing a (finite) floating-
               point number is converted to decimal notation in the
               style  [-]ddd.ddd,
-------------------

so the latter output (with a comma instead of a period)  is wrong.

This behavior breaks a lot of programs (e.g. doxygen generates TeX with
measure-units like 1,6666cm)

Comment 1 Enrico Scholz 2001-01-24 16:24:55 UTC
Sorry, behavior if glibc is correct (I have missed 7.1.1/#); the other programs
are wrong so I have to write a lot of other bugreports.


Note You need to log in before you can comment on or make changes to this bug.