[R] Computing 'exp(1e3)*0' correctly....

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sun Sep 2 01:10:25 CEST 2012


I disagree that this answer is "wrong". If you want a mathematically correct answer you are going to have to obtain it by applying intelligence to the algorithm in which this calculation occurred. This is not a mailing list about numerical methods in general, so it probably isn't appropriate to pursue that conversation here.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

CHEL HEE LEE <gnustats at gmail.com> wrote:

>I have some trouble to deal the value of 'NaN'.  For example, 
>
>> exp(1e3)
>[1] Inf
>> exp(1e3)*0
>[1] NaN
>
>The correct answer should be 0 rather than NaN.  I will very appreciate
>if anyone can share some technique to get a correct answer.
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list