On 2005–08–11, at 11:05, Yitzchak Scott-Thoennes wrote:
The PERL_PRESERVE_IVUV stuff can lose a negative zero.

$ perl -we'$x = -.0; $x *= 1.0; print $x'
0
$ perl -we'$x = -.0; $x *= 1.1; print $x'
-0

Should a negative zero never get IOK turned on?

Certainly not in the case above. In the general case, probably not either. I've no time for a while to attempt a fix.

Interestingly, the NV's still there after the first example. But it's vulnerable:

$ perl -MDevel::Peek -we '$x = -.0; $x *= 1.0;print Dump $x; print Dump $x*1.1; $x *= 1.1; print Dump $x'
SV = PVNV(0x180fc78) at 0x180b63c
  REFCNT = 1
  FLAGS = (IOK,pIOK)
  IV = 0
  NV = -0
  PV = 0
SV = NV(0x180e018) at 0x1801440
  REFCNT = 1
  FLAGS = (PADTMP,NOK,pNOK)
  NV = 0
SV = PVNV(0x180fc78) at 0x180b63c
  REFCNT = 1
  FLAGS = (NOK,pNOK)
  IV = 0
  NV = 0
  PV = 0
--
Dominic Dunlop

Reply via email to