From: terje.mathisen@tmsw.no   
      
   Thomas Koenig wrote:   
   > Terje Mathisen schrieb:   
   >   
   >> I still think the IBM DFP people did an impressively good job packing   
   >> that much data into a decimal representation. :-)   
   >   
   > Yes, that modulo 1000 packing is quite clever. It is relatively   
   > cheap to implement in hardware (which is the point, of course).   
   > Not sure how easy it would be in software.   
      
   Several options, the easiest is of course a set of full forward/reverse   
   lookup tables, but you can take advantage of the regularities by using   
   smaller tables together with a little bit of logic.   
      
   You also need a way to extract one or two digits from the top/bottom of   
   each mod1000 container in order to handle normalization.   
      
   For the Intel binary mantissa dfp128 normalization is the hard issue,   
   Michael S have figured out some really nice tricks to speed it up, but   
   when you have a (worst case) temporary 220+ bit product mantissa,   
   scaling is not that easy.   
      
   The saving grace is that almost all DFP calculations tend to employ   
   relatively small numbers, mostly dfadd/dfsub/dfmul operations with fixed   
   precision, and those will always be faster (in software) using the   
   binary mantissa.   
      
   Terje   
      
   --   
   -    
   "almost all programming can be viewed as an exercise in caching"   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|