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,987 of 5,127   
   Steven G. Kargl to All   
   Re: FRACTION() seems broken in gfortran    
   10 Sep 25 22:03:04   
   
   From: sgk@REMOVEtroutmask.apl.washington.edu   
      
   On Wed, 10 Sep 2025 07:03:42 +0000, Lawrence D’Oliveiro wrote:   
      
   > On Wed, 10 Sep 2025 08:25:04 +0200, pehache wrote:   
   >   
   >> Le 10/09/2025 à 00:41, Lawrence D’Oliveiro a écrit :   
   >>>   
   >>>      ldo@theon:~> python3 -ic "import math"   
   >>>      >>> fraction = lambda x : math.modf(x)[0]   
   >>>      >>> fraction(3.75)   
   >>>      0.75   
   >>>      >>> fraction(2.5)   
   >>>      0.5   
   >>   
   >> And how do you know how `modf()` works without reading the   
   >> documentation?   
   >   
   > The point being, it gives a more natural (i.e. less-surprising) result   
   > than Fortran. That is the point I was trying to make -- the nub of my   
   > gist, if you will. Or even if you won’t. Do not try to distract from   
   > that.   
      
   And we've pointed out that the "most other languages" that you   
   referenced do not have a fraction() function.  Your python   
   example defines a fraction() function in terms of modf().   
   You had to read the documentation to know what modf() does.   
   Well, if you're going to read python documentation, then if   
   you get an unexpected result with Fortran's fraction() you   
   may want to actually read Fortran documentation.   
      
   --   
   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