Thanks Steven. Very clear. Yours sincerely,
Jianhong Ou LRB 670A Program in Gene Function and Expression 364 Plantation Street Worcester, MA 01605 On 12/19/13 5:54 PM, "Steven McKinney" <smckin...@bccrc.ca> wrote: >Yes, floating point issue. > >See e.g. > >http://cran.r-project.org/doc/FAQ/R-FAQ.html >7.31 Why doesn't R think these numbers are equal? > > >> options(digits = 22) >> 29/50 >[1] 0.579999999999999960032 >> 29/50 * 50 >[1] 28.99999999999999644729 >> 29*50/50 >[1] 29.00000000000000000000 >> .58 * 50 >[1] 28.99999999999999644729 >> floor(28.999999) >[1] 28.00000000000000000000 >> floor(29.000000) >[1] 29.00000000000000000000 >> > > > >Steven McKinney > >Statistician >Molecular Oncology and Breast Cancer Program >British Columbia Cancer Research Centre > > > >> -----Original Message----- >> From: bioc-devel-boun...@r-project.org [mailto:bioc-devel-bounces@r- >> project.org] On Behalf Of Ou, Jianhong >> Sent: December-19-13 1:53 PM >> To: bioc-devel@r-project.org >> Subject: [Bioc-devel] simple question about floor >> >> Hi all, >> >> Maybe this is not a bioconductor question but R. However, I feel this is >> very interesting. >> >> I tried >> >> > floor(29/50*50) >> [1] 28 >> > floor(29*50/50) >> [1] 29 >> >> Is this a floating-point problem? How could we explain this? >> >> Yours sincerely, >> >> Jianhong Ou >> >> LRB 670A >> Program in Gene Function and Expression >> 364 Plantation Street Worcester, >> MA 01605 >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioc-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/bioc-devel _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel