From: gah@ugcs.caltech.edu   
      
   Ray wrote:   
   (snip)   
      
   > Yes, John got it right. If we have C code which says,   
      
   > double addend = 0.5;   
   > double sum = 0.0;   
   > while (1){   
   > sum += addend;   
   > addend *= 0.5;   
   > }   
      
   > Then the programmer is a maniac.   
      
   OK, but how about:   
      
    double addend = 0.5;   
    double sum = 0.0;   
    while (addend){   
    sum += addend;   
    addend *= 0.5;   
    }   
      
   -- glen   
   [The traditional Fortran rules say that any transformation that's   
   mathematically valid is OK,   
   even if it's not numerically identical. So translate it to this:   
      
    DOUBLE PRECISION ADDEND, SUM   
    ADDEND = 0.5   
    SUM = 0.0   
   10 IF(ADDEND)20,30,20   
   20 SUM = SUM + ADDEND   
    ADDEND = ADDEND * 5E-1   
    GOTO 10   
   30 CONTINUE   
    STOP   
    END   
      
   -John]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|