Hi, Look at
?NumericConstants At the bottom of the details section you will find: "Note that a leading plus or minus is not regarded by the parser as part of a numeric constant but as a unary operator applied to the constant." See ?Syntax for precedence information. Hope this helps, Colin. -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Zhiyuan Jason ZHENG Sent: 17 November 2009 14:00 To: r-h...@stat.math.ethz.ch Subject: [R] Calculating the power of a negative number Hello, I use R a lot, one thing bugs me is that when I try the following > x<- -8 > x^(1/3) [1] NaN However, it is fine with -8^(1/3). Priority goes to the power. Can you help me out for this? Thanks. Best, Zhiyuan J. ZHENG Ph.D. Candidate Economic Department Virginia Polytechnic Institute and State University Phone: 540-231-5120 , Blacksburg, VA, 24060 [[alternative HTML version deleted]] ______________________________________________ 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. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________ 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.