[R] sqrt(-x) vs. -x^0.5
sarah.goslee at gmail.com
Thu Mar 22 00:17:01 CET 2012
It's order of operations, and a good reason to always use
parentheses: which is evaluated first, the unary minus or
On Wed, Mar 21, 2012 at 7:09 PM, Mike Williamson <this.is.mvw at gmail.com> wrote:
> Hi Everyone,
> I did a search through the archives and did not find an answer,
> although I must admit it is a hard search to do ( ^0.5 is tough to
> explicitly search for ).
> I am sure there is some mathematically accurate reason to explain the
> following, but I guess I either never learned it or have since forgotten it.
> In 'R', when I type (for instance):
> I get
> but if I type in:
> -4 ^ 0.5
> I get
> I presume this is on purpose and correct, but it's the first time I've
> come across any theoretical difference between ^0.5 and sqrt. What is the
> theoretical difference / meaning between these two operations?
More information about the R-help