[R] floor()

Berwin A Turlach berwin at maths.uwa.edu.au
Wed Nov 30 00:47:04 CET 2005


G'day Werner,

>>>>> "WB" == Werner Bier <aliscla at yahoo.com> writes:

    >> floor((5.05-floor(5))*100)
    WB> [1] 4

    WB> I would expect 5, or am I wrong?
You are wrong. :)

Consider:

> (5.05-floor(5))*100
[1] 5
> (5.05-floor(5))*100 - 5
[1] -1.776357e-14

and read FAQ 7.31

Cheers,

        Berwin

========================== Full address ============================
Berwin A Turlach                      Tel.: +61 (8) 6488 3338 (secr)   
School of Mathematics and Statistics        +61 (8) 6488 3383 (self)      
The University of Western Australia   FAX : +61 (8) 6488 1028
35 Stirling Highway                   
Crawley WA 6009                e-mail: berwin at maths.uwa.edu.au
Australia                        http://www.maths.uwa.edu.au/~berwin




More information about the R-help mailing list