Decimal values rounded on save

Linus Torvalds torvalds at linux-foundation.org
Mon Sep 3 11:13:05 PDT 2012


On Mon, Sep 3, 2012 at 10:51 AM, Ivan Habunek <ivan.habunek at gmail.com> wrote:
> On 3 September 2012 19:50, Ivan Habunek <ivan.habunek at gmail.com> wrote:
>>
>> This sounds possible. I use Croatian locale which uses comma as the
>> decimal separator. However, Lubomir reproduced the problem too. Don't
>> know which locale he's on.
>
> I can confirm this is the problem. When I switch to the UK locale, the
> problem goes away.

Good catch. I can reproduce it with

   LC_NUMERIC=fr_FR ./subsurface hvP8Kx90.xml

and no, sscanf() doesn't help.

Damn. I guess we can do the usual

        setlocale(LC_NUMERIC,"C");

at the top of main(). Lazy, but the alternative is to do all the FP
parsing by hand. We do *not* want the file to be locale-dependent.

              Linus


More information about the subsurface mailing list