in reply to Re: big integers forcing me to be a C programmer: "range iterator outside integer range"
in thread big integers forcing me to be a C programmer: "range iterator outside integer range"

Perl limits its range iterators to integers

Actually, signed integers, which gives -2**31..2**31-2

  • Comment on Re^2: big integers forcing me to be a C programmer: "range iterator outside integer range"

Replies are listed 'Best First'.
Re^3: big integers forcing me to be a C programmer: "range iterator outside integer range"
by BrowserUk (Patriarch) on May 07, 2009 at 11:20 UTC

    Well, I never said "unsigned" :) But it's a point worth making. Though on my system the limits are somewhat different:

    ] Perl> print for 1 .. 2**62;; 1 2 3 4 5 6 7 8 9 10 11

    I won't post the rest, so you'll have to take my word that it does actually get beyond 2**31-2 :)


    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.
      Lucky man. You have a 64 bit machine, I bet ... ;-)
        You don't need a 64-bit machine to have Perl be able to perform 64 bit integer arithmetic. You need a compiler who's able to deal with 64-bit arithmetic (you can even have a compiler that isn't able to produce binaries able to use 64 bit arithmetic on 64 bit platforms - for instance, SUN produced 64 bit platforms years before gcc was able to deal with 64 bit integers). And then when compiling Perl, enable the 64 bit integers.