On Fri, 3 Mar 2006, Sundar Dorai-Raj wrote:
Brian S Cade wrote:
Okay, so if this an issue of integer vs double precision real storage, why
is this same calculation not a problem in R. What is done differently
between S-Plus and R? Curious to avoid future problems.
The difference is between S-PLUS < 5 and R on one hand, and S-PLUS >= 5 on
the other. Prior to S-PLUS 5, S stored all parsed numbers as doubles, and
R still does.
Brian
Because of this:
S-PLUS 6.2:
storage.mode(46432)
[1] "integer"
storage.mode(46342*46342)
[1] "integer"
R 2.2.1:
storage.mode(46432)
[1] "double"
storage.mode(46342*46342)
[1] "double"
and also
x <- as.integer(46432)
x * x
[1] NA
Warning message:
NAs produced by integer overflow in: x * x
Adding such a warning in S-PLUS would it seems be helpful.
--
Brian D. Ripley, ripley@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
|