From: antispam@fricas.org   
      
   Michael S wrote:   
   > On Sun, 14 Sep 2025 16:22:33 -0000 (UTC)   
   > antispam@fricas.org (Waldek Hebisch) wrote:   
   >   
   >> Thomas Koenig wrote:   
   >> > Michael S schrieb:   
   >> >> 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)   
   >> >>>   
   >> >>   
   >> >   
   >> > OOOPS.   
   >> >   
   >> > Seems I misread the standard, missing out on clause 17.4 paragraph   
   >> > 5, which states   
   >> >   
   >> > In a procedure other than IEEE_SET_ROUNDING_MODE or IEEE_SET_STATUS,   
   >> > the processor shall not change the rounding modes on entry, and   
   >> > on return shall ensure that the rounding modes are the same as   
   >> > they were on entry.   
   >>   
   >> IIUC this means that user can not define routine like   
   >> 'MY_SET_ROUNDING_MODE' and get desired effect (this probably can be   
   >> worked around using foreign function interface).   
   >>   
   >   
   > I am not sure that I understood.   
   > Do you want to say that user can not write routines that call   
   > IEEE_SET_ROUNDING_MODE ? I don't see anything in citation above that   
   > suggests that.   
      
   Of course thet can.   
      
   > Or do you mean something else?   
      
   The citation above clearly requires that all changes to rounding   
   mode done during execution of user routine are undone at exit   
   from that routine. Consequenty _user_ routine can not change   
   rounding mode of the caller. In other words, user routine can   
   not offer alternative implementation of IEEE_SET_ROUNDING_MODE.   
      
   --   
    Waldek Hebisch   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|