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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |