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,768 of 5,127   
   Steven G. Kargl to Lawrence D'Oliveiro   
   Re: Angle Units For Trig Functions   
   20 Oct 24 05:35:25   
   
   From: sgk@REMOVEtroutmask.apl.washington.edu   
      
   On Sun, 20 Oct 2024 03:47:13 +0000, Lawrence D'Oliveiro wrote:   
      
   > I see that the Fortran 2023 spec has added a bunch of parallel trig   
   > functions that work in degrees.   
      
   No. Fortran does not contain "a bunch of parallel trig functions   
   that work in degrees."  It contains a bunch of elemental functions.   
      
   > I find this sort of thing unnecessary. It seems conventional to add   
   > functions for converting between degrees and radians, but a simpler way is   
   > to simply define a conversion factor for each angle unit. One conversion   
   > factor is simpler than two functions for each angle unit.   
      
   program foo   
      real x, y   
      x = 30+360*1111   
      y = x * (4 * atan(1.) / 180)   
      print *, sind(x), sin(y)   
   end program foo   
      
   % gfcx -o z a.f90 && ./z   
   0.500000000      0.500089288   
      
   One of these values is exact, and one of these raises FE_INEXACT.   
      
   --   
   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