[R] Floating points and floor() ?

David Winsemius dwinsemius at comcast.net
Fri Mar 4 04:33:43 CET 2011


On Mar 3, 2011, at 8:23 PM, Folkes, Michael wrote:

> Perhaps somebody could clarify for me if the following is a floating
> point matter or otherwise, and how am I to correct for it?
>
>> floor(100*.1)
> [1] 10
>
>> 100*(1.0-.9)
> [1] 10
>
>> floor(100*(1-0.9))
> [1] 9
>
>

Yes. It's a "floating point matter". What do you mean by "correct for  
it"? What result would be "correct"?


David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list