Re: [R] exponent confusion

From: Phineas Campbell <>
Date: Thu 23 Feb 2006 - 04:41:56 EST

> -0.7^1.22

[1] -0.6471718


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

> 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.


-----Original Message-----
[]On 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? mailing list PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Thu Feb 23 05:03:40 2006

This archive was generated by hypermail 2.1.8 : Thu 23 Feb 2006 - 06:23:11 EST