[R] Logical inconsistency

Berwin A Turlach berwin at maths.uwa.edu.au
Sat Dec 6 06:50:26 CET 2008


G'day Wacek,

On Fri, 05 Dec 2008 14:18:51 +0100
Wacek Kusnierczyk <Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> wrote:

> well, this answer the question only partially.  this explains why a
> system with finite precision arithmetic, such as r, will fail to be
> logically correct in certain cases.  it does not explain why r, a
> language said to isolate a user from the underlying implementational
> choices, would have to fail this way. 

I am not sure who said that R is "a language said to isolate...", but I
guess you were told this on some other occasion.  For me the question
would be whether a user wants to be isolated from implementational
choices.  I know that I don't, e.g., knowing that R stores matrices in
column-major form instead of row-major form, together with R's
recycling rules,  is very helpful for arranging certain calculations.

> there is, in principle, no problem in having a high-level language
> perform the computation in a logically consistent way.  

Is this now supposed to be a "Radio Eriwan" joke?  As another saying
goes: in theory there is no difference between theory and practice, in
practice there is.

> for example, bc is an "arbitrary precision calculator language", and
> has no problem with examples as the above:

Fair enough, and when bc can fit linear models, generalised linear
models, mixed effect models, non-linear models and the myriad of other
things I need day in day out, preferably in arbitrary precision, then I
might consider changing to it.....

> the fact that r (and many others, including matlab and sage, perhaps
> not mathematica) does not perform logically here is a consequence of
> its implementation of floating point arithmetic. 

But you are wrong here, R performs logically *in the logic of finite
precision arithmetic*.  The problem is that you are using finite
precision arithmetic but expect that the rules and logic of infinite
precision arithmetic hold.  If you want to use have infinite precision
arithmetic, then use a tool that (supposedly) implements it.
 
Cheers,

	Berwin

=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability        +65 6516 6650 (self)
Faculty of Science                          FAX : +65 6872 3919       
National University of Singapore     
6 Science Drive 2, Blk S16, Level 7          e-mail: statba at nus.edu.sg
Singapore 117546                    http://www.stat.nus.edu.sg/~statba



More information about the R-help mailing list