> -0.7^1.22
[1] -0.6471718

(-0.7)^1.22
>NaN

Arithmetically this makes perfect sense, syntactically I'm not sure it does.

>z<-c(-0.7)
> z == -0.7
[1] TRUE
> z^1.22
[1] NaN


I remember a programming homily: if you are unsure of the operator
precedence then you shouldn't assume the person who has to maintain your
code has any better knowledge so you should make the order in which you want
expressions to be evaluated explicit.

Phineas



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of tom wright
Sent: Wednesday, February 22, 2006 10:14 AM
To: R-Stat Help
Subject: [R] exponent confusion


please excuse me if this ones a basic error

> y<-c(-0.7,-0.6,-0.5)
> -0.7^1.22
[1] -0.6471718

> y^1.22
[1] NaN NaN NaN

am I missing something important in my basic math?

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to