Re: [R] Ceiling function gives me wrong answer

2012-11-28 Thread Berend Hasselman
On 29-11-2012, at 03:10, Ying Zheng wrote: > Hi all, > > I have a very simple code, but gives a wrong answer. > > a=1000 > b=1000^(1/3) > c=ceiling(a/b) > > then c=101, > > if change the code to be > a=1000 > b=10 > c=ceiling(a/b) > > then c=100 is fine. See R FAQ 7.31 "Why doesn't R think

Re: [R] Ceiling function gives me wrong answer

2012-11-28 Thread Anthony Damico
not sure ceiling() is behaving inappropriately.. > b <- 1000^( 1/3 ) > b [1] 10 > options( digits = 22 ) > b [1] 9.998223643 check out http://blog.revolutionanalytics.com/2009/11/floatingpoint-errors-explained.htmlfor more detail On Wed, Nov 28, 2012 at 9:10 PM, Ying Zheng wro

Re: [R] Ceiling function gives me wrong answer

2012-11-28 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Ying Zheng > Sent: Wednesday, November 28, 2012 6:11 PM > To: r-help@r-project.org > Subject: [R] Ceiling function gives me wrong answer > > Hi all, &

[R] Ceiling function gives me wrong answer

2012-11-28 Thread Ying Zheng
Hi all, I have a very simple code, but gives a wrong answer. a=1000 b=1000^(1/3) c=ceiling(a/b) then c=101, if change the code to be a=1000 b=10 c=ceiling(a/b) then c=100 is fine. Thank you for the help. [[alternative HTML version deleted]] __