nicolas_simonis at dfci.harvard.edu
2008-Jan-30 17:55 UTC
[Rd] logical operator and addition (PR#10665)
Full_Name: Nicolas Simonis Version: 2.6.1 OS: windows Submission from: (NULL) (155.52.10.223) Very funny bug :> 0.6<0.6[1] FALSE> 0.6<0.4+0.2[1] TRUE control :> 0.7<0.7[1] FALSE> 0.7<0.4+0.3[1] FALSE With R 2.6.1 windows. it's not doing it with R 2.3.1 linux...
nicolas_simonis at dfci.harvard.edu wrote:> Full_Name: Nicolas Simonis > Version: 2.6.1 > OS: windows > Submission from: (NULL) (155.52.10.223) > > > Very funny bug : > > >> 0.6<0.6 >> > [1] FALSE > >> 0.6<0.4+0.2 >> > [1] TRUE > >I don't see a bug here, I see failure to read FAQ 7.31. The value 0.6 is less than 0.4+0.2, when the operation is done in floating point approximations. None of those three numbers is exactly representable. > (0.4+0.2) - 0.6 [1] 1.110223e-16 Duncan Murdoch> control : > > >> 0.7<0.7 >> > [1] FALSE > >> 0.7<0.4+0.3 >> > [1] FALSE > > With R 2.6.1 windows. it's not doing it with R 2.3.1 linux... > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
ripley at stats.ox.ac.uk
2008-Jan-31 11:50 UTC
[Rd] logical operator and addition (PR#10665)
This seems another instance of FAQ Q7.31> 0.6 - (0.4 + 0.2)[1] -1.110223e-16 On Wed, 30 Jan 2008, nicolas_simonis at dfci.harvard.edu wrote:> Full_Name: Nicolas Simonis > Version: 2.6.1 > OS: windows > Submission from: (NULL) (155.52.10.223) > > > Very funny bug :(rather a very common FAQ, when asked as a question)>> 0.6<0.6 > [1] FALSE >> 0.6<0.4+0.2 > [1] TRUE > > control : > >> 0.7<0.7 > [1] FALSE >> 0.7<0.4+0.3 > [1] FALSE > > With R 2.6.1 windows. it's not doing it with R 2.3.1 linux...It depends on the compiler and optimization settings: it is doing it on 2.3.1 Linux for me (and 2.6.2 RC).> > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595