There are tokens that will be understood as infinity, but it's dependant on the underlying C library. It's easier just to calculate it.

use constant POS_INF => +(99**99**99); use constant NEG_INF => -(99**99**99);

(Is that big enough for a long double system?)

Active Perl 5.6.0, 5.6.1, 5.8.0, 5.8.8, 5.10.0 on Windows:

>perl -MDevel::Peek -e"Dump +(99**99**99)" SV = NV(0x1832414) at 0x225334 REFCNT = 1 FLAGS = (PADBUSY,PADTMP,NOK,READONLY,pNOK) NV = 1.#INF >perl -MDevel::Peek -e"Dump -(99**99**99)" SV = NV(0x1832424) at 0x22531c REFCNT = 1 FLAGS = (PADBUSY,PADTMP,NOK,READONLY,pNOK) NV = -1.#INF

Some Perl 5.8.4 on linux:

$ perl -MDevel::Peek -e'Dump +(99**99**99)' SV = NV(0x8165bd0) at 0x8160954 REFCNT = 1 FLAGS = (PADBUSY,PADTMP,NOK,READONLY,pNOK) NV = inf $ perl -MDevel::Peek -e'Dump -(99**99**99)' SV = NV(0x8165be0) at 0x814cc9c REFCNT = 1 FLAGS = (PADBUSY,PADTMP,NOK,READONLY,pNOK) NV = -inf

In reply to Re: How to create nan/inf by ikegami
in thread How to create nan/inf by syphilis

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, details, 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, summary, 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.