not sure ceiling() is behaving inappropriately.. > b <- 1000^( 1/3 ) > b [1] 10 > options( digits = 22 ) > b [1] 9.999999999999998223643
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 <martin.yingzh...@gmail.com>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. > > Thank you for the help. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.