The problem (for me) is that there are no IVs involved in your construction
C:\>perl -MDevel::Peek -le "Dump(2);"
SV = IV(0x1daf1b8) at 0x1daf1bc
REFCNT = 1
FLAGS = (PADTMP,IOK,READONLY,pIOK)
IV = 2
C:\>perl -MDevel::Peek -le "Dump(1025);"
SV = IV(0x53ee70) at 0x53ee74
REFCNT = 1
FLAGS = (PADTMP,IOK,READONLY,pIOK)
IV = 1025
Or, alternatively, I could have assigned the values 2 and 1025 to two IV's.
The interpreter constructs a compile-time constant from the expression and stores it as an NV.Yes, nothing remarkable about that - most perl users (you and I included) are aware of this and generally comfortable with it.
However, it implies to me that in perl, there are no distinct realms of ints and floats. And your remark that "NaN is a purely floating point concept" (which is correct) suddenly seemed a bit blurry wrt perl - because, in so many ways, perl doesn't draw a line between floats and ints - yet it does have NaNs.
Anyway ... I should have tried harder to explain the triviality or, better still, just made a mental note of it and said nothing.
I sure am glad I didn't create a demo where the upgrade from IV to NV occurred because of integer overflow ... then manipulate the NV to create a NaN ... then claim to have shown that a NaN *can* arise from integer overflow. Something like:
C:\>perl -le "$x= ~0; $x += 2; $x **= 35; $x /= $x; print $x;"
-1.#IND
;-))
(Complete and utter sophistry, of course.)
Cheers,
Rob
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.