in reply to Infinity and Inf?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Infinity and Inf?
by LanX (Saint) on Aug 31, 2010 at 17:55 UTC | |
by ikegami (Patriarch) on Aug 31, 2010 at 18:02 UTC | |
by LanX (Saint) on Aug 31, 2010 at 18:09 UTC | |
by ikegami (Patriarch) on Aug 31, 2010 at 18:37 UTC | |
|
Re^2: Infinity and Inf?
by DrHyde (Prior) on Sep 01, 2010 at 07:34 UTC | |
by ikegami (Patriarch) on Sep 01, 2010 at 15:54 UTC | |
by LanX (Saint) on Sep 01, 2010 at 12:58 UTC | |
by ikegami (Patriarch) on Sep 01, 2010 at 15:51 UTC | |
by LanX (Saint) on Sep 01, 2010 at 16:36 UTC | |
by ikegami (Patriarch) on Sep 01, 2010 at 19:16 UTC | |
by BrowserUk (Patriarch) on Sep 01, 2010 at 14:53 UTC | |
by ikegami (Patriarch) on Sep 01, 2010 at 16:08 UTC | |
by LanX (Saint) on Sep 01, 2010 at 15:09 UTC | |
by BrowserUk (Patriarch) on Sep 01, 2010 at 16:42 UTC | |
| |
by BrowserUk (Patriarch) on Sep 01, 2010 at 13:16 UTC | |
by LanX (Saint) on Sep 01, 2010 at 13:27 UTC | |
by tye (Sage) on Sep 01, 2010 at 13:53 UTC | |
| |
|
Re^2: Infinity and Inf?
by LanX (Saint) on Aug 31, 2010 at 18:17 UTC | |
by ikegami (Patriarch) on Aug 31, 2010 at 18:34 UTC | |
by LanX (Saint) on Aug 31, 2010 at 18:47 UTC |