Re: [R] unexpected behavior using round to 2 digits on randomly generated numbers

2010-11-29 Thread Petr Savicky
On Sun, Nov 28, 2010 at 01:53:05PM -0800, Jeff Newmiller wrote: > FAQ 7.31 > > http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f Additional information concerning rounding errors of double precision and suggestions for R code, which avoids them in

Re: [R] unexpected behavior using round to 2 digits on randomly generated numbers

2010-11-28 Thread David Winsemius
On Nov 28, 2010, at 4:43 PM, David Winsemius wrote: On Nov 28, 2010, at 4:20 PM, Cory Rieth wrote: Hello! I stumbled upon something odd that took a while to track down, and I wanted to run it by here to see if I should submit a bug report. For randomly generated numbers (from a variety

Re: [R] unexpected behavior using round to 2 digits on randomly generated numbers

2010-11-28 Thread Jeff Newmiller
FAQ 7.31 http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f You find it odd that the result is not an integer, while I find the fact that your calculation actually works reliably with any number of digits surprising, and you should avoid assuming

Re: [R] unexpected behavior using round to 2 digits on randomly generated numbers

2010-11-28 Thread Peter Ehlers
On 2010-11-28 13:20, Cory Rieth wrote: Hello! I stumbled upon something odd that took a while to track down, and I wanted to run it by here to see if I should submit a bug report. For randomly generated numbers (from a variety of distributions) rounding them to specifically 2 digits and then

Re: [R] unexpected behavior using round to 2 digits on randomly generated numbers

2010-11-28 Thread Duncan Murdoch
On 28/11/2010 4:20 PM, Cory Rieth wrote: Hello! I stumbled upon something odd that took a while to track down, and I wanted to run it by here to see if I should submit a bug report. For randomly generated numbers (from a variety of distributions) rounding them to specifically 2 digits and the

Re: [R] unexpected behavior using round to 2 digits on randomly generated numbers

2010-11-28 Thread David Winsemius
On Nov 28, 2010, at 4:20 PM, Cory Rieth wrote: Hello! I stumbled upon something odd that took a while to track down, and I wanted to run it by here to see if I should submit a bug report. For randomly generated numbers (from a variety of distributions) rounding them to specifically 2 dig

[R] unexpected behavior using round to 2 digits on randomly generated numbers

2010-11-28 Thread Cory Rieth
Hello! I stumbled upon something odd that took a while to track down, and I wanted to run it by here to see if I should submit a bug report. For randomly generated numbers (from a variety of distributions) rounding them to specifically 2 digits and then multiplying them by 100 produces strange