RE: [tcltk-perl] return of 1=>1.0 transformation error
Brought to you by:
hobbs
From: Jeff H. <je...@Ac...> - 2004-04-28 17:27:25
|
> > my $row = 0; > > foreach my $leaf('Tk.xbm','Xcamel.gif') > > { ... > > my $col = 0; > > $mw->Label(-text => 'Initial') > > ->grid(-row => $row, -column => $col); > > $mw->Label(-background => 'white',-image => $src) > > ->grid(-row => $row+1, -column => $col++); > > ... > > > > We see that the problem is at -row 1, so that last line is the issue. > > That this becomes SvNOK w/o being SvIOK in Perl 5.6 seems "just wrong" > Perl 5.6.1 doesn't do anything weird there for me. Maybe it it the > grid() method that modifies the SV? grid only ever passes the args through, and this is only ever touched by the C internals. That means it goes through the same path when == 0 as == 1. It's possible that this code: if (SvIOK(sv) && ((double)(ival = SvIV(sv)) == dval)) { returns different results for 0 as 1.0, but a quick C check with this: int ival = 1; double dval = 1.0; printf("%d\n", (((double)(ival = (int)dval)) == dval)); Says it should convert back and forth OK (that shows '1'). I know you will have issues with incorrect double equality on some corner cases. > You can investigate this using Devel::Peek. It is not part I only have 5.8 installed, so it always works for me. Perhaps Vadim would like to hunt this down? Jeff |