[R] question about precision, floor, and powers of two.

From: Dr Carbon <drcarbon_at_gmail.com>
Date: Tue 01 Nov 2005 - 04:03:34 EST


At the risk of being beaten about the face and body, can somebody explain why the middle example: log2(2^3); floor(log2(2^3)) is different than examples 1 and 3?

> log2(2^2); floor(log2(2^2))

[1] 2
[1] 2
> log2(2^3); floor(log2(2^3))

[1] 3
[1] 2
> log2(2^4); floor(log2(2^4))

[1] 4
[1] 4
>

DrC

        [[alternative HTML version deleted]]



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 Sat Nov 05 01:13:55 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:56 EST