Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Range iterator outside integer range

Infinity is a float, and the range operator requires an integer. Both of the following would get you the max int:

use constant MAX_INT => unpack('J', pack('j', -1)); use constant MAX_INT => 0+sprintf('%u', -1);

You could also use a C-style loop:

for (my $_ = 1; ; ++$_)

I tried to define a lazy iteration and I know that I can redefine the constant for my needs

It's not a symbol (i.e., not a constant, a sub or a builtin).

$ perl -e'Inf()' Undefined subroutine &main::Inf called at -e line 1. $ perl -Mstrict -e'Inf' Bareword "Inf" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors.

It's just a string that some underlying C libraries numify to a value representing infinity.

It seems to be a feature of Math::BigInt

It's an feature of the hardware floating point number format. Math::Big* may also support it, but that's unrelated.


In reply to Re: Infinity and Inf? by ikegami
in thread Infinity and Inf? by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (9)
    As of 2017-10-19 21:11 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My fridge is mostly full of:

















      Results (257 votes). Check out past polls.

      Notices?