[R] Rounding

peter dalgaard pdalgd at gmail.com
Sat Jan 5 20:57:32 CET 2013


On Jan 5, 2013, at 20:30 , Rolf Turner wrote:

> On 01/06/2013 07:42 AM, David Arnold wrote:
>> Hi,
>> 
>> Can someone explain this:
>> 
>>> options(digits=20)
>>> 1/3
>> [1] 0.33333333333333331483
>> 
>> Why the 1483 at the end?
> 
> There are 10 sorts of people; those who understand binary
> arithmetic and those who don't.  See also FAQ 7.31.

Actually, it seems there are 11 sorts; those who understand binary, those who understand floating point binary, and those who do neither. The first 0.010101010101010101... of these would seem to the the issue here.

(Or 1.0101010101...e-10 if you want to split hairs.)

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com




More information about the R-help mailing list