On Fri, 8 Feb 2002, Joe Schell wrote: > > > > -----Original Message----- > > From: Carl Jolley [mailto:[EMAIL PROTECTED]] > > > > > > > > > > Your (1) above is more complex. The error occurs in the > > following range > > > > > > > > > > 2^31-1 to 2^32-1 > > > > > > > > > > Where 2^32 works correctly. > > > > > > > > > > > > > Could I prevail upon you one more time to check that ? It's not > > > > what I get. > > > > I'm finding that, when multiplying by a numeric literal constant, > > > > instead of > > > > getting 2^32 returned to '$result', I'm getting zero. > > > > > > > > > > Correct. range should be 2^31-1 to 2^32 > > > > > > > I can't figure out any of discussion related to the 2^31-1 stuff. > > The arithemetic calculation mode of perl should only be sensitive > > to 32-bit integer arithemetic only if a "use integer;" pragma is > > in effect on a machine with 32-bit integers. The default calculation > > mode of perl should be floating point. > > > > Really? > > I was under the impression that the perlish structure that represents a > value in perl contains a floating and integer component (along with a string > component and some other parts.) And until a floating point representation > was needed, the integer representation was used. > > And the range of numbers is certainly consistent with 32 bit signed > rollover. I wouldn't know how to explain it in terms of floating point > representations. >
The point I made in passing in my previous reply to your message about bit-wise operations resulting in integers was perhaps a bit too subtle. I realized that when I re-read your message and saw your notation 2^31-1, etc. it dawned on me that perhaps someone had made a mistake in their aritmmetic expressions which would not be caught by a perl syntax check even with the -w flag set. Perhaps someone thought that the ^ operator was the exponentation operator -- not the bit-wise exclusive OR operation. Use of ^ when it should have been ** would certainly result in integer-precision truncation of results. **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs