develooper Front page | perl.perl5.porters | Postings from March 2014

Re: Perl 5.20.0 Blockers, 2014-03-24

Thread Previous | Thread Next
March 31, 2014 04:14
Re: Perl 5.20.0 Blockers, 2014-03-24
Message ID:

-----Original Message----- 
From: Slaven Rezic
Sent: Monday, March 31, 2014 4:38 AM
To: Ricardo Signes
Subject: Re: Perl 5.20.0 Blockers, 2014-03-24

Ricardo Signes <> writes:

>> 6.  Gconvert() obeys LC_NUMERIC without "use locale"
>>     Karl asserts that the change is correct, although a new macro may be
>>     warranted.  I think I agree.  Dissenters should dissent soon.  It 
>> would
>>     probably be nice to have that wrapper available soon, too.
> The LC_NUMERIC change does not only affesct Gconvert, but any XS
> functionality using functions like strtod or sprintf with floating point
> conversion specifiers. Without even doing systematic CPAN smoking I
> found quite a number of CPAN modules which are broken because of this.


> SISYPHUS/Math-GMPf-0.37.tar.gz
> I suspect that every CPAN module using strtod/sprintf indirectly through
> a shared library is broken.

I saw the failing Math-GMPf-0.37 test reports and surmised that these were 
actually bugs in the test suite - because the failing tests involved strings 
such as "123.45" (which is not a valid number when the decimal point is 
represented by a comma).
Passing such a value to the gmp library's mpf_set_str() function causes the 
function to return true (-1), which indicates that the string is not a valid 
number (for the given base).
Whenever mpf_set_str() returns true (-1), I have the XS code that called it 
croak .... and hence the test failures.

GMP's mpf_set_str() documentation contains:
[quote]The decimal point expected is taken from the current locale, on 
systems providing localeconv [/quote]

So, it's the gmp library that's detecting that ',' is the requisite decimal 
point, and all of the test failures emanate from using '.' as the decimal 
Is that what's supposed to be happening ?

That *is* a bug in the test suite .... right ?
I mean, we shouldn't really be passing (to the gmp library) numeric strings 
that contain a '.' as the decimal point, because there's no guarantee that 
'.' is the decimal point for the current localeconv setting.


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