[R] (-8)^(1/3) == NaN?

Liviu Andronic landronimirc at gmail.com
Sun Jul 19 22:49:13 CEST 2009


On Sun, Jul 19, 2009 at 12:28 AM, jim holtman<jholtman at gmail.com> wrote:
> First of all, read FAQ 7.31 to understand that 1/3 is not
> representable in floating point.  Also a^b is actually exp(log(a) * b)
> and log(-8) is not valid (NaN).
>

If this is so, why would the following evaluate as expected?
> (-8)^(3)
[1] -512

Liviu




More information about the R-help mailing list