In this particular case it is part of the C99 stanadrd (7.12.7.4) for
the 'pow' function R uses.
On Wed, 27 Oct 2010, Berwin A Turlach wrote:
G'day Gregory,
On Tue, 26 Oct 2010 19:05:03 -0400
Gregory Ryslik <rsa...@comcast.net> wrote:
Hi,
This might be me missing something painfully obvious but why does the
cube root of the following produce an NaN?
(-4)^(1/3)
[1] NaN
1/3 is not exactly representable as a binary number. My guess is that
the number that is closest to 1/3 and representable cannot be used as
the exponent for negative numbers, hence the NaN.
Essentially, don't expect finite precision arithmetic to behave like
infinite precision arithmetic, it just doesn't. The resources
mentioned in FAQ 7.31 can probably shed more light on this issue.
Cheers,
Berwin
========================== Full address ============================
Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr)
School of Maths and Stats (M019) +61 (8) 6488 3383 (self)
The University of Western Australia FAX : +61 (8) 6488 1028
35 Stirling Highway
Crawley WA 6009 e-mail: ber...@maths.uwa.edu.au
Australia http://www.maths.uwa.edu.au/~berwin
______________________________________________
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.
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
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.