# New Ticket Created by masterchiefaragorn # Please include the string: [perl #126502] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=126502 > Hi, I don't know if this is an issue with Storable or with Perl itself, but when I compare two identical floating points together, they compare correctly. However, when I freeze() and thaw() them, they do not. I am familiar with the dynamics of how floating points are stored, so that's not the issue. The issue is that Storable slightly alters an SvPVNV in a way that it doesn't compare like it used to. Here's the code (this is on Perl 5.18 and Storable 2.51): use 5.018001; use warnings; use Math::Round qw(nearest); use Storable qw(freeze thaw); my $a = nearest(.01,-656.8); my $b = nearest(.01,-656.8); if ($a eq 'qwer') {} # this upgrades $a to an SvPVNV say '' . ($a == $b ? 'EQUAL' : 'NOT EQUAL'); my $c = thaw(freeze(\$a)); # here Storable alters the SvPVNV so that it compares incorrectly my $d = thaw(freeze(\$b)); say '' . ($c == $d ? 'EQUAL' : 'NOT EQUAL'); OUTPUT: EQUAL NOT EQUAL (NOTE: I know that '==' is unreliable for comparing floating point numbers, and that doing a nearest(.01,$a) eq nearest(.01,$b) is a more reliable way to solve this. Regardless, I still think this might be a bug folks would want addressed?)Thread Next