Re: [R] floor() rounding problem?

From: Sean Davis <sdavis2_at_mail.nih.gov>
Date: Tue 09 Aug 2005 - 21:49:55 EST


On 8/9/05 7:42 AM, "Simon Woodhead" <simon.woodhead@bristol.ac.uk> wrote:

> 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

This is a FAQ
(http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these- numbers-are-equal_003f)

Hope this helps.
Sean



R-help@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 Received on Tue Aug 09 21:55:38 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:11:27 EST