Explain the output
>> # a is a (large) vector with numerical elements >> any(is.nan(a)) [1] FALSE >> any(is.nan(exp(a))) [1] FALSE >> any(is.nan(exp(1.0 * a))) [1] FALSE >> any(is.nan(exp(0.0 * a))) [1] TRUE
See something surprizing? Suddenly a NaN where there was none before?
Can you think why this is happening?
Hint
If you give up, then click-and-drag to select and see the hint below:
>> # Multiplying an Infinity with zero gives a NaN >> Inf * 0 [1] NaN
~
musically_ut
No comments:
Post a Comment