home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.fortran      Putting John Backus on a giant pedestal      5,127 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,531 of 5,127   
   Steven G. Kargl to pehache   
   Re: SCALE intrinsic subprogram (aka a Fo   
   16 Nov 23 20:01:02   
   
   From: sgk@REMOVEtroutmask.apl.washington.edu   
      
   On Thu, 16 Nov 2023 11:17:31 +0000, pehache wrote:   
      
   > Le 16/11/2023 à 02:28, gah4 a écrit :   
   >> On 11/4/23 2:21 PM, Steven G. Kargl wrote:   
   >>> The SCALE intrinsic allows one to change the floating point exponent   
   >>> for a REAL entity.   
   >>> For example,   
   >>>   
   >>> program foo   
   >>>     real x x = 1 print *, scale(x,1) ! print 2   
   >>> end program   
   >>>   
   >>> This scaling does not incur a floating point rounding error.   
   >>>   
   >>> Question.  Anyone know why the Fortran standard (aka J3) restricted X   
   >>> to be a REAL entity?  It would seem that X could be COMPLEX with   
   >>> obvious equivalence of   
   >>>   
   >>> SCALE(X,N) = COMPLX(SCALE(X%RE,N),SCALE(X%IM,N),KIND(X%IM))   
   >>>   
   >>> Should the Fortran be amended?   
   >>   
   >>   
   >> Wow, no answer yet.   
   >>   
   >> It does seem that sometimes Fortran is slow to add features, especially   
   >> when need for them isn't shown.   
   >   
   > The reason is maybe because the standard doesn't specify how a complex   
   > number is internally represented. In practice it is always represented   
   > by a pair (real,imag), but nothing would prevent a compiler representing   
   > it by (module,argument) for instance. Given that, the standard cannot   
   > guarantee the absence of rounding errors.   
      
   You are correct that the Fortran standard does not specify   
   internal datails, and this could be extended to COMPLEX.   
   It would however be quite strange for a Fortran vendor to   
   use magnitude and phase given that the Fortran standard does   
   quite often refer to the real and imaginary parts of a COMPLEX   
   entity.  Not to mention, the Fortran standard has introduced:   
      
   3.60.1   
   complex part designator   
      
   9.4.4 Complex parts   
      
   R915 complex-part-designator   is designator % RE   
                                  or designator % IM   
      
   PS: If a Fortran vendor used magnitude and phase, then the vendor   
   would need to specify a sign convention for the phasor.  I'm mpt   
   aware of any vendor that does.   
      
   --   
   steve   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca