From dmurdoch@pair.com  Fri Oct  4 12:00:55 2002
From: dmurdoch@pair.com (dmurdoch@pair.com)
Date: Fri, 4 Oct 2002 13:00:55 +0200 (MET DST)
Subject: Problem with construction (1-x)^(1-y) (PR#2103)
Message-ID: <200210041100.NAA24710@pubhealth.ku.dk>

On Fri, 4 Oct 2002 05:57:23 +0200 (MET DST), you wrote:

>> (1-x)^0.5
>[1] NaN
>> (1-x)
>[1] -4
>> -4^.5
>[1] -2

As Uwe mentioned, you can't take square roots of negative real
numbers, you need to force them to complex first.

The reason it worked in the last example is that exponentiation has
higher precedence than unary negation, so "-4^.5" is evaluated as
"-(4^.5)".

Duncan Murdoch

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Problem with construction (1-x)^(1-y) (PR#2103)
dmurdoch@pair.com