(-1)^2
 Or
a <- -1
a^2
-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of rkevinbur...@charter.net
Sent: January 3, 2009 3:33 PM
To: r-help@r-project.org; r-h...@stat.math.ethz.ch
Subject: [R] Power functions?

I had a question about the basic power functions in R.

For example from the R console I enter:

-1 ^ 2
[1] -1

but also

-1^3
[1] -1

-0.1^2
[1]  -0.01

Normally pow(-1, 2) return either -Infinity or NaN. Has R taken over the
math functions? If so I would think that -1^2 is 1 not -1 and -0.1^2 is 0.01
not -0.01.

Thank you.

Kevin

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to