|laziness, impatience, and hubris|
nans, infs, and vomitby syphilis (Bishop)
|on Sep 01, 2008 at 13:00 UTC||Need Help??|
syphilis has asked for the wisdom of the Perl Monks concerning the following question:
With perl 5.10 (and no doubt earlier) on linux, the string 'nan', when used in a numeric context, actually becomes a nan ... and the string 'inf', when used in a numeric context, actually becomes an infinity.
I understand it has something to do with the underlying libc, but I'm also wondering what the underlying rationale is (if there *is* any). Is there, eg, some IEEE standard that encourages this nauseating behaviour ?
Afaict on Win32, there's no string (PV) that, when used in numeric context, will be treated as either a nan or an infinity ... and, to my way of thinking, that's exactly as it should be. For once windows gets it right and ignores the "Ooooh, wouldn't it be groovy to have strings that become nans/infinities when used numerically" temptation.
But, then again, I've been wrong before and maybe there are good reasons that perl on linux decides to indulge in what are, to me, nothing more than gimmicks for the feeble-minded. That being the case, precisely what *are* those "good reasons" ?