⭐ in reply to How do I create/detect/handle Infinity?
Creating Inf/NaN:
use Devel::Peek; $inf = (~@~)**(~@~); $nan = $inf / $inf; Dump $_ for $inf, $nan; __END__ SV = NV(0x9e15f84) at 0x9dfc11c REFCNT = 2 FLAGS = (NOK,pNOK) NV = inf SV = NV(0x9e15f9c) at 0x9dfc59c REFCNT = 2 FLAGS = (NOK,pNOK) NV = nan
Detecting Inf/NaN: since they are numeric values, Inf and NaN can be tested for with the numeric equality/inequality operators == and !=. For Inf, greater and less also work.
Handling: not useful ;-)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Answer: How do I create/detect/handle Infinity?
by ysth (Canon) on Jul 26, 2009 at 06:26 UTC | |
by syphilis (Archbishop) on Jul 26, 2009 at 08:41 UTC | |
by ysth (Canon) on Jul 26, 2009 at 10:12 UTC | |
by syphilis (Archbishop) on Jul 26, 2009 at 12:07 UTC | |
by ysth (Canon) on Jul 26, 2009 at 20:32 UTC |
In Section
Seekers of Perl Wisdom