develooper Front page | perl.perl5.porters | Postings from June 2013

[perl #61754] 'Data::Dumper' reports double value as string.

Thread Previous
Tony Cook via RT
June 26, 2013 01:47
[perl #61754] 'Data::Dumper' reports double value as string.
Message ID:
On Sun Feb 03 10:34:34 2013, jkeenan wrote:
> Discussion in this RT petered out about twelve months ago.
> Are there any changes to code or documentation which we should still be
> considering?

I've updated the status to mark the patch as rejected based on the

Nicholas complained that:

> I don't think that we should change behaviour to use floating point
> If we did this, we'd implicitly add a round trip conversion in the reading
> code (parser converts decimals to binary floating point, sv_2pv() converts
> binary floating point back to decimal), which may introduce errors.

but the current mechanism:

a) already does a round trip, if the user supplied the data as a float,
presumably they expect to use it as a float in the code that uses the
value, so it will need to be converted.

b) already introduces errors:

tony@mars:.../git/perl$ ./perl -Ilib -MData::Dumper -e 'print
$VAR1 = '1';
tony@mars:.../git/perl$ perl -le 'print 1.0000000000001-1'

Fixing that is little more complex than the supplied though - possibly
keep adding digits until values match.


via perlbug:  queue: perl5 status: open

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