[R] cube root
Sascha Vieweg
saschaview at gmail.com
Sun Apr 17 11:38:48 CEST 2011
On 11-04-17 07:51, Branimir K. Hackenberger wrote:
> This is some interesting:
>
>> -8^(1/3)
>
> [1] -2
>
>> x=(-8:8)
>
>> y=x^(1/3)
>
>> y
>
> [1] NaN NaN NaN NaN NaN NaN NaN NaN
> 0.000000 1.000000
>
> [11] 1.259921 1.442250 1.587401 1.709976 1.817121 1.912931 2.000000
>
> So, can anybody explain this?! (Why is x[1]^(1/3)=y[1]=NaN, but
> -8^(1/3)=-2?)
-8^(1/3) == (-8)^(1/3) # NA
-8^(1/3) == -(8^(1/3)) # TRUE
> Thx!!!
You're welcome.
--
Sascha Vieweg, saschaview at gmail.com
More information about the R-help
mailing list