Subject: | Precision issue on dumping NVs |
Hello!
It seems that Devel::Peek (and Data::Dumper as well) uses some different precision settings when dumping the NV scalars. This renders the output utterly confusing and makes debugging really hard.
Tried with Devel::Peek 1.08 and 1.26
Thank you!
#!/usr/bin/perl
use v5.16;
use Data::Dumper;
use Devel::Peek;
$|++;
$Data::Dumper::Terse = 1;
my $str_15_digits = '100.000000000000001';
my $str_14_digits = '100.00000000000001';
my $num_14_digits = 100.00000000000001;
my $num_13_digits = 100.0000000000001;
my $num_12_digits = 100.000000000001;
my @r = ($str_15_digits, $str_14_digits,
$num_14_digits, $num_13_digits, $num_12_digits);
say (
(Dumper($_) =~ s/\n$//r) .
($_ > 100 ? ' is greater than 100' : '')
) for @r;
say 'Looking a bit deeper:';
Dump($_) for @r