[R] floor() rounding problem?

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Tue Aug 9 13:54:19 CEST 2005


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: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Simon Woodhead" <simon.woodhead at bristol.ac.uk>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, August 09, 2005 1:42 PM
Subject: [R] floor() rounding problem?


> 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
>
> Thank you,
> Simon
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list