Re: R-alpha: Machine Constants

Peter Dalgaard BSA (pd@kubism.ku.dk)
06 Dec 1996 18:29:10 +0100


To: Douglas Bates <bates@stat.wisc.edu>
Subject: Re: R-alpha: Machine Constants
From: Peter Dalgaard BSA <pd@kubism.ku.dk>
Date: 06 Dec 1996 18:29:10 +0100
In-Reply-To: Douglas Bates's message of Fri, 6 Dec 1996 09:30:50 -0600 (CST)
Message-Id: <x2682ffuop.fsf@bush.kubism.ku.dk>

Douglas Bates <bates@stat.wisc.edu> writes:

> 
> The version of machar.c that George sent gives incorrect results when
> compiled on an Intel-Linux machine with -O.  I haven't tried declaring
> the variables as volatile yet.

Um. I haven't had time to actually study the code, but I wonder if
this isn't of the same ilk as the "paranoia" program, which regularly
throws people into a loop (and their programs too) when they optimize
it. Thing is, for example, that it contains stuff like (I'm
paraphrasing here)

x = 1;
do {
	x *= 2;
	y = x + 1;
	y -= x ;
}
while (y > 0);

- and the optimizer will happily fuse the two assignments to y into 

y = 1;

There is no requirement that an optimized program should give exactly
the same results as the optimized one, otherwise the optimizer
couldn't really do anything. In the case above, volatile-ing the y
variable will help, but I'm not sure it catches everything. Better is:
Don't optimize it! It can't be that hard to set up the relevant rule
in the makefile?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-