develooper Front page | perl.perl5.porters | Postings from April 2019

Re: [perl #133945] ce6f496d720f6206455628425320badd95b07372 breaksfloat formatting under GTK

Thread Previous | Thread Next
Karl Williamson
April 15, 2019 17:06
Re: [perl #133945] ce6f496d720f6206455628425320badd95b07372 breaksfloat formatting under GTK
Message ID:
On 3/20/19 12:03 PM, Dmitry Karasik (via RT) wrote:
> # New Ticket Created by  Dmitry Karasik
> # Please include the string:  [perl #133945]
> # in the subject line of all future correspondence about this issue.
> # <URL: >
> This is a bug report for perl from,
> generated with the help of perlbug 1.41 running under perl 5.29.2.
> -----------------------------------------------------------------
> [Please describe your issue here]
> ce6f496d720f6206455628425320badd95b07372 changed float/double formatting
> from strtoflt128 to Perl_strtod, which had a nasty side effect when running
> under non-english locales (or I suspect with locales that use comma for decimal point)
> together with GTK or any other library that calls setlocale() itself.
> The test for this is rather elaborate, so I'm attaching a localebug module
> that tests for it when run 'make test'. One needs the following (for Ubuntu, for
> example):
> * apt-get install libgtk2.0-dev (gtk development files)
> * cpan ExtUtils::PkgConfig
> * locale-gen de_DE.UTF-8 && update-locale (tests need de_DE.UTF-8)
> When running with a faulty configuration, the core issue is basically this:
>      my $s = sprintf "%s", 4.9999;
>      die "bug:$s" if $s !~ /^4[,.]9999$/;
> which prints just "4".
> The module attached can also be found at
> [Please do not change anything below this line]

I tried your (thoughtfully included) test bed, making sure that perl.h 
was changed to call straight strtod(), and couldn't get it to fail.

But I created a branch where I wrap Perl_strtod() with calls to use the 
proper radix character.  Please try it out and report back.

It's at

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About