> Full_Name: Ben Phalan
> Version: 2.2.1
> OS: Win XP
> Submission from: (NULL) (188.8.131.52)
> I have noticed that floor returns the wrong number when there are more
> than 15
> decimal places:
>  6
>  7
> There is a similar problem with ceiling, so this may apply to all/most
> rounding functions?
>> ceiling (2.000000000000001)
>  3
>> ceiling (2.0000000000000001)
>  2
This is not a problem (nor a bug) with 'floor' or 'ceiling'.
The "problem" (in quotes because the real problem is the user's)
is in R, intrinsic to the finite-length floating-point arithmetic
which is used. See:
so, in fact, R cannot "see" the 16th decimal place when you enter
a number to that precision -- it is simply lost. Exactly the same
"problem" would arise at some point whatever the finite precision
to which a floating-point number is stored. The effect is not
confined to functions 'floor' and 'ceiling' or any similar
"rounding" functions. It applies to all functions; it is simply
more obvious with the rounding functions.
and the first two items in the output are:
showing that the smallest difference which can be "seen" by R
is greater than 1-^(-16).
So, when you type it in, you *think* you have entered
into R, but you have not. So the user has to face the problem of
how to cope with the finite-length representation in any situation
where the distinction between 2 and 2.0000000000000001 really