[Rd] Inconsistency in treating NaN-results?
Mark van der Loo
mark.vanderloo at gmail.com
Thu Nov 26 10:07:17 CET 2015
This question is more out of curiosity than a complaint or suggestion, but
I'm just wondering.
The behavior of R on calculations that result in NaN seems a bit
# this is expected:
# but this gives a warning
In sin(Inf) : NaNs produced
# and this again does not
Conceptually, I like to think that R computes over the real line augmented
with NaN, Inf, -Inf, NaN, and NA (which is technically also NaN). As far as
I know, this set is closed under R's arithmetic operations and mathematical
functions (following the IEEE standard on double precision). If that's the
case, the result sin(Inf)=NaN seems normal to me and a warning is
So why the choice to have warning on sin(Inf), but not on 0/0 or exp(Nan)?
Is it just historical or am I missing a reasoning or some standard?
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS
 LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
 LC_TIME=nl_NL.UTF-8 LC_COLLATE=en_US.UTF-8
 LC_MONETARY=nl_NL.UTF-8 LC_MESSAGES=en_US.UTF-8
 LC_PAPER=nl_NL.UTF-8 LC_NAME=C
 LC_ADDRESS=C LC_TELEPHONE=C
 LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C
[[alternative HTML version deleted]]
More information about the R-devel