This is not surprizing at all!
The exact result is log(8,2) = 3, but the numerical
procedure which calculates the logarithm may produce a
result which is a few ULPs different from the exact
one, i.e. you can get that log(8,2) = 2.99
and then floor(2.99) = 2.
--- Fausto Gall
On Tue, 26 Jun 2007, Fausto Galli wrote:
>
> Hello everybody
>
> My collegue and I noticed a strange behaviour of R on different
> platforms. It's a simple computation, but results are rather different.
>
> On Windows XP:
>
> > floor(log(8,2))
> [1] 3
>
> which is what one should expect.
> Here's
Sorry, my mistake. I should really leave looking at the help list
until AFTER my morning coffee :P
On 26-Jun-07, at 11:31 AM, Duncan Murdoch wrote:
> On 6/26/2007 10:20 AM, Mike Lawrence wrote:
>> According to the description of floor(), the latter result is the
>> correct one:
>>
>> 'floor tak
On 6/26/2007 10:20 AM, Mike Lawrence wrote:
> According to the description of floor(), the latter result is the
> correct one:
>
> 'floor takes a single numeric argument x and returns a numeric vector
> containing the largest integers *not greater than* the corresponding
> elements of x.' (e
According to the description of floor(), the latter result is the
correct one:
'floor takes a single numeric argument x and returns a numeric vector
containing the largest integers *not greater than* the corresponding
elements of x.' (emphasis added)
floor(3) == 2
>True
On 26-Jun-07, at
Hello everybody
My collegue and I noticed a strange behaviour of R on different
platforms. It's a simple computation, but results are rather different.
On Windows XP:
> floor(log(8,2))
[1] 3
which is what one should expect.
Here's instead the result with Mac OS X (same version, 2.5.0
(200