but why a shift to right of ? bin(-9, 64) 1111111111111111111111111111111111111111111111111111111111110111
is not 0111111111111111111111111111111111111111111111111111111111111011 and it is ? bin(lsr(-9,1), 64) 0000000000000000000000000000000001111111111111111111111111111011 ??? because lsr processes 32 bits of the short -9 and not 64 bits of the long binary number? On Sat, 2010-11-20 at 17:58 +0200, Jussi Lahtinen wrote: > Argh... no. > Try this: > ? bin(Lsr(-9,1),32) > 01111111111111111111111111111011 > > Jussi > > > On Sat, Nov 20, 2010 at 17:55, Jussi Lahtinen <jussi.lahti...@gmail.com>wrote: > > > > > PRINT "Bin(-9) :"; Bin(-9) > >> PRINT "Bin(Lsl(-9, 1)):"; Bin(Lsl(-9, 1)) > >> PRINT "Bin(Lsr(-9, 1)):"; Bin(Lsr(-9, 1)) > >> > >> Bin(-9) > >> :1111111111111111111111111111111111111111111111111111111111110111 > >> > >> Bin(Lsl(-9,1)):1111111111111111111111111111111111111111111111111111111111101110 > >> Bin(Lsr(-9,1)):1111111111111111111111111111011 > >> > >> Lsl is correct, it adds a 0 at the right and shift binary to left > >> Lsr i think is wrong > >> > >> -9 is > >> 1111111111111111111111111111111111111111111111111111111111110111 > >> > >> Lsr(-9,1) should be > >> 0111111111111111111111111111111111111111111111111111111111111011 > >> > >> > > I think the sign bit shouldn't be shifted. So this is correct. > > > > Jussi > > > > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today > http://p.sf.net/sfu/msIE9-sfdev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -- Regards, Demosthenes Koptsis. ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user