[R] cube root of a negative number
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Wed Oct 27 02:28:14 CEST 2010
Because it is implemented as
antilog((1/3)*log(-4))
most likely using base 2 for the log/antilog functions.
"Gregory Ryslik" <rsaber at comcast.net> wrote:
>Hi,
>
>This might be me missing something painfully obvious but why does the
>cube root of the following produce an NaN?
>
>> (-4)^(1/3)
>[1] NaN
>>
>
>As we can see:
>
>> (-1.587401)^3
>[1] -4
>
>Thanks!
>
>Greg
>______________________________________________
>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.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
More information about the R-help
mailing list