Re: [R] floor()

2005-11-29 Thread Berwin A Turlach
G'day Werner, WB == Werner Bier [EMAIL PROTECTED] writes: floor((5.05-floor(5))*100) WB [1] 4 WB I would expect 5, or am I wrong? You are wrong. :) Consider: (5.05-floor(5))*100 [1] 5 (5.05-floor(5))*100 - 5 [1] -1.776357e-14 and read FAQ 7.31 Cheers, Berwin

Re: [R] floor()

2005-11-29 Thread Austin, Matt
I believe this is a FAQ. Examine: format((5.05-floor(5))*100, nsmall=16) [1] 4.9822 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Werner Bier Sent: Tuesday, November 29, 2005 3:35 PM To: r-help@stat.math.ethz.ch Subject: [R] floor()

Re: [R] floor()

2005-11-29 Thread Werner Bier
Yep! You are right I am going through it right now Thanks W Austin, Matt [EMAIL PROTECTED] wrote: I believe this is a FAQ. Examine: format((5.05-floor(5))*100, nsmall=16) [1] 4.9822 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of

Re: [R] floor()

2005-11-29 Thread Ted Harding
On 29-Nov-05 Werner Bier wrote: Dear All, Is this right? floor((5.05-floor(5))*100) [1] 4 I would expect 5, or am I wrong? Thanks and regards, W It may seem reasonable to expect it, but in the case of R (and most other computer languages) you would be wrong.

Re: [R] floor() rounding problem?

2005-08-09 Thread Sean Davis
On 8/9/05 7:42 AM, Simon Woodhead [EMAIL PROTECTED] wrote: Dear all, Could someone please explain the following perculiarity? 2 == 0.2/0.1 [1] TRUE 3 == 0.3/0.1 [1] FALSE Similarly, floor(0.2/0.1) = 2 floor(0.3/0.1) = 2 This is a FAQ

Re: [R] floor() rounding problem?

2005-08-09 Thread Uwe Ligges
Simon Woodhead wrote: Dear all, Could someone please explain the following perculiarity? Please read the FAQ Why doesn't R think these numbers are equal (as the posting gude asks you to do). Uwe Ligges 2 == 0.2/0.1 [1] TRUE 3 == 0.3/0.1 [1] FALSE Similarly, floor(0.2/0.1)

Re: [R] floor() rounding problem?

2005-08-09 Thread Dimitris Rizopoulos
Look at ?Comparison, especially in the Note section, i.e., 3 == 0.3/0.1 identical(all.equal(3, 0.3/0.1), TRUE) Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel:

Re: [R] floor of n observations in number generators

2003-12-30 Thread Peter Dalgaard
Marcus Davy [EMAIL PROTECTED] writes: I couldnt find a previous posting on this in the archives, maybe it has already been mentioned. If you use a calculation to generate n observations in random number generators and you don't round to the nearest integer you may be generating n-1 numbers