Try printing floor(100*.29): you have forgotten about representation error.

From the help page:
       n: number of observations. If 'length(n) > 1', the length is
          taken to be the number required.

and you asked for (just) less than 29 observations, and got what you asked for.

On Thu, 7 Aug 2008, [EMAIL PROTECTED] wrote:

Full_Name: Paul Eckermann
Version: 2.7.1
OS: Windows XP Service Pack 2
Submission from: (NULL) (129.127.183.12)


This is the first time I have submitted a bug report, so apologies if I have not
followed the correct protocol.

If I enter

length(rnorm(100*.29))

it returns 28 rather than 29.

y<-(1:100)/100
z<-sapply(y,function(x) length(rnorm(x*100)))
z!=100*y

indicates that it has something to do with multiples of 7 (rounding error?),
even though 29, 57 and 58 are the 3 values for which it returns incorrect values
of z.

I hope that this is not something obvious that I have missed. This can be overcome by doing the x*100 calculation outside the rnorm function, but I don't see why this needs to be done when the answer is (supposed to be) an integer.

Supposed by whom?

Regards,
Paul Eckermann

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


--
Brian D. Ripley,                  [EMAIL PROTECTED]
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-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to