Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Incrementing "Infinity" bug

by kcott (Bishop)
on Mar 25, 2013 at 16:28 UTC ( #1025337=note: print w/replies, xml ) Need Help??


in reply to Re^2: Incrementing "Infinity" bug
in thread Incrementing "Infinity" bug

I came across Inf (and friends) some years ago, decided they all looked somewhat flakey, and haven't used them since. Your posting has (somewhat) piqued my interest again. Here's some interesting results from Scalar::Util's looks_like_number() function.

$ perl -E ' use Scalar::Util qw{looks_like_number}; my @infs = (inf, Inf, INF, infinity, Infinity, INFINITY, -inf, -Inf, -INF, -infinity, -Infinity, -INFINITY, Inftyddssssd, infighting, Infighting, -Inftyddssssd, -infighting, -Infighting); say "$_ : ", looks_like_number($_) for @infs; ' inf : 20 Inf : 20 INF : 20 infinity : 20 Infinity : 20 INFINITY : 20 -inf : 28 -inf : 28 -inf : 28 -inf : 28 -inf : 28 -inf : 28 Inftyddssssd : 0 infighting : 0 Infighting : 0 -Inftyddssssd : 0 -infighting : 0 -Infighting : 0

I also noted that the documentation for this function links to perlapi - looks_like_number, which may be of interest ot you.

-- Ken

Replies are listed 'Best First'.
Re^4: Incrementing "Infinity" bug
by LanX (Archbishop) on Mar 25, 2013 at 16:49 UTC
    I suppose these numbers reflect some flags?

    something like:

    2^3 for negative

    2^2 for special value

    2^4 for infinity

    couldn't find explanation in the docs.

    > decided they all looked somewhat flakey,

    agreed, but shouldn't we try to fix it.

    Don't you think the algorithm I used is a valid use case? (non-reachable integer)

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2019-12-08 01:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (162 votes). Check out past polls.

    Notices?