From: terje.mathisen@tmsw.no   
      
   Michael S wrote:   
   > On Sun, 2 Nov 2025 11:36:36 +0100   
   > Terje Mathisen wrote:   
   >   
   >> Thomas Koenig wrote:   
   >>> MitchAlsup schrieb:   
   >>>>   
   >>>> Terje Mathisen posted:   
   >>>   
   >>>>> Actually, for the five required basic operations, you can always   
   >>>>> do the op in the next higher precision, then round again down to   
   >>>>> the target, and get exactly the same result.   
   >>>>   
   >>>> https://guillaume.melquiond.fr/doc/05-imacs17_1-article.pdf   
   >>>   
   >>> The PowerISA version 3.0 introduced rounding to odd for its 128-bit   
   >>> floating point arithmetic, for that very reason (I assume).   
   >>   
   >> Rounding to odd is basically the same as rounding to sticky, i.e if   
   >> there are any trailing 1 bits in the exact result, then put that in   
   >> the ulp position.   
   >>   
   >> We have known since before the 1978 ieee754 standard that   
   >> guard+sticky (plus sign and ulp) is enough to get the rounding   
   >> correct in all modes.   
   >>   
   >> The single exception is when rounding up from the maximum magnitude   
   >> value to inf should be suppressed, there you do in fact need to check   
   >> all the bits.   
   >>   
   >> Terje   
   >>   
   >   
   > People use names like guard and sticky bits and sometimes also rounding   
   > bit (e.g. in Wikipedia article) without explanation, as if everybody   
   > had agreed about what they mean. But I don't think that everybody   
   > really agree.   
      
   Within the 754 working group the definition is totally clear:   
      
   Guard is the first bit after the normal mantissa.   
      
   Sticky is the bit following the guard bit, it is generated by OR'ing   
   together all subsequent bits in the exact/infinitely precise result.   
      
   I.e if an exact result is exactly halfway between two representable   
   numbers, the Guard bit will be set and Sticky unset.   
      
   Ulp (Unit in Last Place)) is the final mantissa bit   
      
   Sign is of course the sign in the Sign-Magnitude format used for all fp   
   numbers.   
      
   This means that those four bits in combination suffices to separate   
   between rounding directions:   
      
   Default rounding is nearest or even: (In this case Sign does not matter.)   
      
   Ulp | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |   
   Guard | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |   
   Sticky | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |   
      
   Round | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 |   
      
   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)   
|