in reply to Re^3: nans, infs, and vomit
in thread nans, infs, and vomit
http://www.perl.com/doc/FMTEYEWTK/is_numeric.html
Yes - that puts this behaviour into context. When any string is put into numeric context, perl just hands that string over to the underlying C implementation of atof(), and we're then at the mercy of what that function does with the string it has been passed.
On some systems, atof turns the strings 'nan' and 'inf' into actual nans and infinities. On other implementations of atof,a nan/inf will never result from a call to atof - irrespective of what string it receives. This is not a very convenient situation ... but we can't blame perl for differences in the underlying C libraries.
Thanks for the link Anonymous Monk.
Cheers,
Rob
Yes - that puts this behaviour into context. When any string is put into numeric context, perl just hands that string over to the underlying C implementation of atof(), and we're then at the mercy of what that function does with the string it has been passed.
On some systems, atof turns the strings 'nan' and 'inf' into actual nans and infinities. On other implementations of atof,a nan/inf will never result from a call to atof - irrespective of what string it receives. This is not a very convenient situation ... but we can't blame perl for differences in the underlying C libraries.
Thanks for the link Anonymous Monk.
Cheers,
Rob
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: nans, infs, and vomit
by ysth (Canon) on Sep 02, 2008 at 03:27 UTC | |
by syphilis (Archbishop) on Sep 02, 2008 at 06:04 UTC | |
by ysth (Canon) on Sep 02, 2008 at 06:08 UTC | |
by syphilis (Archbishop) on Sep 02, 2008 at 10:10 UTC |
In Section
Seekers of Perl Wisdom