in reply to (tye)Re: Simple Rotation
in thread Simple Rotation

Assuming you're not under use integer, you have about 9 thousand-trillion cycles before it sputters out. Probably sufficient for most uses :)

Under use integer, all bets are off after about 4 million:

use integer; $y = $x = 0xFFFFFFFF; $x += 1; $y++; print "x:$x y:$y\n"
Interesting behaviour, no? I wonder how $y is stored internally...
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
(tye)Re2: Simple Rotation
by tye (Sage) on May 20, 2001 at 01:10 UTC

    Uh, 9 thousand billion (9 quadrillion to stupid Americans who don't realize that it doesn't make sense to refer to "1 thousand million" as "a billion") is what I was talking about (not 9 thousand trillion unless you have 73-bit mantissas on your system -- or were you just using American numbers while avoiding the little-used "quadrillion" term?). (:

    Your code above shows that auto increment isn't considered "math" by use integer, so $y is stored as a double, BTW.

    Update: America vs. the world:
    English-speaking WorldStupid Americas
    1,000thousandthousand
    11000,000millionmillion
    1,0001000,000thousand million (or milliard)billion
    12000,0001000,000billiontrillion
    1,0002000,0001000,000thousand billionquadrillion
    13000,0002000,0001000,000trillionquintillion
    1,0003000,0002000,0001000,000thousand trillionsextillion

    So when I read "thousand trillion", I think "not stupid American, 1e21". My Perl numbers stop incrementing by one a little ways after 9e15 which I prefer to call "9 thousand billion" (being an American but one that knows enough to see that using "billion" for three sets of three zeros doesn't make as much sense as using "billion" for two sets of six zeros) but "officially" Americans are supposed to call that "9 quadrillion". If you ignore the non-American world, then "9 thousand trillion" might be just another way of saying "9 quadrillion". (:

    Anyway, that is what I meant. And thanks for giving me an excuse to rant about this. ;)

            - tye (but my friends call me "Tye")
      Well, until around 9 thousand trillion, the floating point representation of the number has enough bits of mantissa to properly represent the least significant digit. Or so it seems, from my tests.

      I suppose the autoincrement isn't considered math because of the ability to do $string++.

         MeowChow                                   
                     s aamecha.s a..a\u$&owag.print