in reply to Re^3: Infinity and Inf? (MAX_INT)
in thread Infinity and Inf?

The range operator seems only to be implemented for signed 32bits integers

On a 64-bit perl, it handles integers greater than 32-bit.

Though there appears to be a bug. Somewhere in between, the 64-bit integers are being transitioned through an NV (double) before being converted back to integers for the iterator it seems:

for my $p ( 32 .. 64 ) { my $n = 2**$p; printf "\n$p"; printf " $_" for $n .. $n + 2; };; 32 4294967296 4294967297 4294967298 33 8589934592 8589934593 8589934594 34 17179869184 17179869185 17179869186 35 34359738368 34359738369 34359738370 36 68719476736 68719476737 68719476738 37 137438953472 137438953473 137438953474 38 274877906944 274877906945 274877906946 39 549755813888 549755813889 549755813890 40 1099511627776 1099511627777 1099511627778 41 2199023255552 2199023255553 2199023255554 42 4398046511104 4398046511105 4398046511106 43 8796093022208 8796093022209 8796093022210 44 17592186044416 17592186044417 17592186044418 45 35184372088832 35184372088833 35184372088834 46 70368744177664 70368744177665 70368744177666 47 140737488355328 140737488355329 140737488355330 48 281474976710656 281474976710657 281474976710658 49 562949953421312 562949953421313 562949953421314 50 1125899906842624 1125899906842625 1125899906842626 51 2251799813685248 2251799813685249 2251799813685250 52 4503599627370496 4503599627370497 4503599627370498 53 9007199254740992 9007199254740993 9007199254740994 54 18014398509481984 55 36028797018963968 56 72057594037927936 57 144115188075855872 58 288230376151711744 59 576460752303423488 60 1152921504606846976 61 2305843009213693952 62 4611686018427387904 63[Range iterator outside integer range at (eval 21) line 1, <STDIN> l +ine 17.

Good luck in trying to track that bug down :)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^5: Infinity and Inf? (MAX_INT)
by ikegami (Patriarch) on Sep 01, 2010 at 16:08 UTC

    Though there appears to be a bug. Somewhere in between, the 64-bit integers are being transitioned through an NV (double) before being converted back to integers for the iterator it seems:

    There is code that assumes NV vars can handle larger integers than IV and UV vars can. That's not the case for all builds anymore, so these builds have unexpected overflow conditions.

    (BrowserUK probably knows that, but I thought someone else might be curious.)

Re^5: Infinity and Inf? (MAX_INT)
by LanX (Saint) on Sep 01, 2010 at 15:09 UTC
    Thanks but thats not my problem, its the break of symmetry between .. and ++ which "bugs" me!

    IMHO it doesn't make sense to restrict the rangeoperator to signed integers when floats can still represent bigger integers (which are perfectly transparent when used with arithmetic operators).

    Cheers Rolf

      IMHO it doesn't make sense to restrict the rangeoperator to signed integers when floats can still represent bigger integers

      I can sort of sympathise with that.

      But for counterpoint, does it make sense to restrict the iteration of a float iterator to unitary integer increments?


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        I don't know if I understand you right, you mean to allow rational stepwidth?

        Something like BASIC's FOR 3.3 TO 7.8 STEP 0.5?

        IMHO the C-Style for is already meant to handle this.

        Cheers Rolf