develooper Front page | perl.perl5.porters | Postings from October 2016

Re: Bug in setting of POK flag ?

Thread Previous | Thread Next
From:
sisyphus1
Date:
October 29, 2016 06:26
Subject:
Re: Bug in setting of POK flag ?
Message ID:
7A2DE6EA2B7946A9BC2ACFBFBAFA94ED@OwnerPC311012
>On Wed, Oct 26, 2016 at 12:34:54PM +1100, sisy...@optusnet.com.au wrote:
>> Hi,
>>
>> By way of demonstration:
>>
>> ##########################
>> use Devel::Peek;
>>
>> $x = 1.75;
>> $y = 2.25;
>>
>> Dump $x;
>> print $x;
>> Dump $x;
>> if($y ne 'hello') {Dump $y}
>> #########################
>>
>> $x and $y initially have (NOK, pNOK) flags set.
>> And with perl 5.20 and later, that's the way it stays.
>>
>> But with perl 5.18 and earlier, both $x and $y end up with
>> (NOK,POK,pNOK,pPOK) flags set.
>>
>> Which is the correct behaviour ?
>
> It's a bug fix:
>
> commit b127e37e51c21b0a36755dcd19811be931a03d83
> Author: Karl Williamson <pub...@khwilliamson.com>
> Date:   Mon May 13 07:35:35 2013 -0600
>
>     PATCH: [perl #108378] [perl #115800]
>    This patch solves two tickets.  Both are a result of the 
> stringification
>     of a floating number being sticky, so that the character representing
>     the decimal point may be from an old locale.  The patch solves this by
>     not retaining the stringification of NVs.

Thanks Dave.

I just noticed that the stringification of NVs *is* retained if the NV is an 
inf or a nan.
That seemed a bit odd at first - but I guess it's acceptable (as neither inf 
nor nan contain a decimal point).

Cheers,
Rob 


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About