[R] Floating points and floor() ?

From: Folkes, Michael <Michael.Folkes_at_dfo-mpo.gc.ca>
Date: Thu, 03 Mar 2011 18:23:36 -0800


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

Thanks!
Michael



Michael Folkes
Salmon Stock Assessment
Canadian Dept. of Fisheries & Oceans Pacific Biological Station
3190 Hammond Bay Rd.
Nanaimo, B.C., Canada
V9T-6N7
Ph (250) 756-7264 Fax (250) 756-7053 Michael.Folkes_at_dfo-mpo.gc.ca

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 04 Mar 2011 - 02:26:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Mar 2011 - 08:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive