http://qs321.pair.com?node_id=11135510


in reply to Difference between Perl and Java for << operator?

-268435456 implies the JavaScript interpreter is using signed 32 bit numbers. The 4026531840 result implies Perl is representing the value as a 32 bit unsigned number.

0xFFFFFFFF is a 32 bit value. If you shift it left by 28 bits you need 32 + 28 = 60 bits to represent the number so neither answer is actually correct in the sense that the true arithmetic result is given.

With Perl you have the option of building perl (the interpreter) yourself and setting parameters like the size of various numeric types. An out of the box 64 bit Perl will use 64 bit integer variables and would give the correct result in this case.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond