rramacha
2005-Oct-26 04:58 UTC
[R] R- exp(-1000) ? - how to get R to give me an actual answer ?
Dear All,
I am a novice user of the R software package. When I try and compute,
exp(-1000) or exp(-2000), i get the answer as zero. Is there any way i can get
R to compute the answer and give me an actual number ? ( by increasing the
precision or any other method).
If I cannot get R to give me a number, can anybody give me some advice on how
to manually compute this number ?
I would greatly appreciate your help on this issue.
Thanks
Ravi
Ravichandran "Ravi" Ramachandran
Graduate Teaching Assistant
Department of Statistics
The University of Tennessee,Knoxville
USA
E-mail : ravi at utk.edu
Phone : Official - 865 - 974 - 2739 (Aconda Court)
Residence - 865 - 946 - 5155
Webpage : http://web.utk.edu/~rramacha
" Space maybe the final frontier
But its made in a Hollywood basement
- The Red Hot Chilli Peppers - 'Californication'
Space maybe the final frontier
But it can be 'replicated' in a Hollywood basement
- Me, after taking the Stat 573 class
"
"Thank God every day when you get up that you have something to do that day
which must be done whether you like it or not. Being forced to work and forced
to do your best will breed in you temperance and self-control, diligence and
strength of will"
- Basil Carpenter
Gabor Grothendieck
2005-Oct-26 05:42 UTC
[R] R- exp(-1000) ? - how to get R to give me an actual answer ?
Since log base 10 is log(x)/log(10) the exponent is: floor(log(exp(-1000))/log(10)) = floor(-1000/log(10)) which in an R session gives: > floor(-1000/log(10)) [1] -435 and the mantissa is: exp(-1000)/10^(-435) = exp(-1000)/exp(-435*log(10)) = exp(-1000+435*log(10)) which in an R session gives: > exp(-1000+435*log(10)) [1] 5.075959 Thus the answer is 5.075959e-435 though, of course, we can't represent that directly on your computer. We can double check this with yacas which is a free computer algebra system that supports arbitrary precision math: In> N(Exp(-1000)) Out> 0.5075958898e-434 On 10/26/05, rramacha <rramacha at utk.edu> wrote:> Dear All, > > I am a novice user of the R software package. When I try and compute, > exp(-1000) or exp(-2000), i get the answer as zero. Is there any way i can get > R to compute the answer and give me an actual number ? ( by increasing the > precision or any other method). > > If I cannot get R to give me a number, can anybody give me some advice on how > to manually compute this number ? > > I would greatly appreciate your help on this issue. > > Thanks > Ravi > > Ravichandran "Ravi" Ramachandran > > Graduate Teaching Assistant > Department of Statistics > The University of Tennessee,Knoxville > USA > E-mail : ravi at utk.edu > Phone : Official - 865 - 974 - 2739 (Aconda Court) > Residence - 865 - 946 - 5155 > Webpage : http://web.utk.edu/~rramacha > > > " Space maybe the final frontier > But its made in a Hollywood basement > - The Red Hot Chilli Peppers - 'Californication' > > Space maybe the final frontier > But it can be 'replicated' in a Hollywood basement > - Me, after taking the Stat 573 class > " > > > "Thank God every day when you get up that you have something to do that day which must be done whether you like it or not. Being forced to work and forced to do your best will breed in you temperance and self-control, diligence and strength of will" > - Basil Carpenter > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >