From: user5857@newsgrouper.org.invalid   
      
   anton@mips.complang.tuwien.ac.at (Anton Ertl) posted:   
      
   > MitchAlsup writes:   
   > >Single rounding for 2^n FPs   
   >   
   > Given that usual FP arithmetics does not satisfy the associative law,   
   > one cannot transform easily-written reductions like   
   >   
   > double r=0.0   
   > for (...)   
   > r += a[i];   
      
   Anton, I am surprised you have not heard of Quires !!! where the   
   accumulator is the full exponent and fraction width. Posits have   
   it, I have it on authority that IEEE 754 is doing something along   
   this for next time.   
      
   Give a Quire, one can accumulate any number of terms and get the   
   right answer from a single rounding of all terms. Accumulations   
   into a quire DO satisfy Associativity.   
      
   But you are right, given IEEE 754 AS IS you cannot. And this is the   
   problem.   
      
   > into any more efficient form (e.g., one with several computation   
   > strands or one that uses a complete tree evaluation). Compilers use   
   > the allowance given by -ffast-math to reassociate the computations and   
   > to vectorize such code. Of course, if you implement FP operations in   
   > general without inexact results, your FP operations are associative,   
   > but I fail to see how that can be achieved in general.   
      
   Also, given a Quire, the compiler becomes FREE to reorder arithmetic   
   terms in a reduction.   
      
   >   
   > - anton   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|