R can hold very small numbers. It is the round-off error during addition (and other basic operations) that causes the problem. For example: > x=1e-300 > x [1] 1e-300 > (x+1)-1 [1] 0
If you need a code that can be immune to round-off problems - you need to write it yourself (please correct me if I am wrong). At some point I needed 'sum' and 'cumsum' that would not have that problem and I end up writing my own versions of those functions. See examples of 'sum.exact' and 'cumsum.exact' in 'caTools' package. Jarek Tuszynski -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 22, 2005 12:53 PM To: [email protected] Subject: [R] how to keep very small or large number? When I was computing some joint probabilities, I found that R reported most of the results to to -Inf and thus didn't record the value. I guess it is b/c the joint log(probability) can be extremely small. Is there a way in R to keep the values even if they are small? ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
