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
inconsistent.
# this is expected:
0/0
[1] NaN
# but this gives a warning
sin(Inf)
[1] NaN
Warning message:
In sin(Inf) : NaNs produced
# and this again does not
exp(NaN)
[1] NaN
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
unnecessary.
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?
Best,
Mark