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

The simple answer is no. Perl limits its range iterators to integers. But even if it allowed floating point iterators it wouldn't help you, as there is no binary floating point representation that can accurately hold a 315,653(*) 309 digit integer!

(*Perl lied to me! Don't use bignum; and use Math::BigInt; in the same code. It appears to get confused!)


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.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re: big integers forcing me to be a C programmer: "range iterator outside integer range"
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: big integers forcing me to be a C programmer: "range iterator outside integer range"
by shmem (Chancellor) on May 07, 2009 at 11:14 UTC
    Perl limits its range iterators to integers

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

      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 ... ;-)