[R] WIERD: Basic computing in R

Thomas Lumley tlumley at u.washington.edu
Tue Jul 1 23:28:59 CEST 2008


This is FAQ 7.33

 	-thomas

On Tue, 1 Jul 2008, poolloopus at yahoo.com wrote:

> Can someone please enlighten me as to why the following happens?
>> -2.7^8.6
> [1] -5125.407
>
>> p<- -2.7
>> q<- 8.6
>> p^q
> [1] NaN
> R seems perfectly able to calculate -2.7^8.6, but fails when the exact same values are assigned to variables and then the computation is repeated.
> Thanks in advance for any suggetsions.
> Kris.
>
> ______________________________________________
> 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.
>

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle



More information about the R-help mailing list