From: already5chosen@yahoo.com   
      
   On Sun, 14 Sep 2025 07:18:38 -0000 (UTC)   
   Thomas Koenig wrote:   
      
   > Michael S schrieb:   
   > > On Sat, 13 Sep 2025 14:55:58 -0000 (UTC)   
   > > Thomas Koenig wrote:   
   > >   
   > >> Similarly, rounding modes are saved and restored for procedures.   
   > >   
   > > I am not sure that I understand.   
   > > 1. Is Fortran's equivalent of C's fesetround() is considered a   
   > > languge primitive rather than procedure?   
   >   
   > Fortran has intrinsic procedures (like SIN, MATMUL or CPU_TIME),   
   > procedures from intrinsic modules, like COMPILER_OPTIONS   
   > from ISO_FORTRAN_ENV, and user-defined procedures.   
   > IEEE_SET_ROUNDING_MODE is a procedure from an intrinsic module   
   > (but an optional one). It need not be an external function;   
   > the compiler is free to do other things to implement it.   
   >   
   > (Hope this answers your question)   
   >   
      
   It will answer the question if you also say that the rule stated above   
   (rounding mode saved on entry and restored on exit) does not apply   
   to procedures from intrinsic modules. Or may be does apply to the   
   rest of procedures in intrinsic modules and IEEE_SET_ROUNDING_MODE is   
   an exception?   
      
   > > 2. Does above said mean that caller has no way of modifying rounding   
   > > mode used by callee? If true, it defeats one of original reasons for   
   > > which Kahan invented rounding modes in the first place.   
   >   
   > The caller cannot change the callee's rounding mode without the   
   > callee having been designed for this (by taking the rounding mode   
   > as an extra argument and using IEEE_SET_ROUNDING_MODE itself).   
   >   
   > I think that's a good idea. If a library routine is written   
   > and debugged for a particular rounding mode, results should   
   > not change because somebody up the call tree changed it.   
      
   Personally, I never found the whole rounding modes business useful in   
   my practice. So, can not say with straight face whether Fortran's take   
   on it is good idea or not. But I can say with good level of certainty   
   that William Kahan meant something else.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|