Re: [Rd] Bug in rnorm? (PR#12016)

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 07 Aug 2008 10:47:03 +0100 (BST)

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, paul.eckermann_at_adelaide.edu.au 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_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley_at_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-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 07 Aug 2008 - 09:51:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 07 Aug 2008 - 10:36:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive