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.
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- 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
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||