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,980 of 5,127   
   pehache to All   
   Re: FRACTION() seems broken in gfortran    
   09 Sep 25 08:08:29   
   
   From: pehache.7@gmail.com   
      
   Le 09/09/2025 à 00:16, Lawrence D’Oliveiro a écrit :   
    > On Mon, 8 Sep 2025 15:25:28 +0200, pehache wrote:   
    >   
    >> Le 17/08/2025 à 09:15, Lawrence D’Oliveiro a écrit :   
    >>>   
    >>> The way you describe is obviously the most natural interpretation,   
    >>> these days. And most other languages do it that way. But not   
    >>> Fortran.   
    >>   
    >> Can you elaborate on what these "most other languages" are ? I   
    >> cannot find any intrinsic function that corresponds to the "most   
    >> natural interpretation" in most of the popular languages around (C,   
    >> C++, Pthon, Java, Rust, Matlab...)   
    >   
    > Python doesn’t have a fraction() function as such,   
      
   Neither any of the other languages. In contrast to your initial assertion.   
      
    > but it does have   
    > modf , which is   
    > documented as returning “the fractional and integer parts” of its   
    > argument.   
      
   Which is a behavior that you can hardly guess without reading the doc,   
   same as `FRACTION()` in Fortran. And yet, you do not blame Python for that.   
      
    > Using the same examples as started this thread:   
    >   
    >      ldo@theon:~> python3 -ic "import math"   
    >      >>> math.modf(3.75)   
    >      (0.75, 3.0)   
    >      >>> math.modf(2.5)   
    >      (0.5, 2.0)   
      
   And Fortran has `MOD()`, that can be used to directly get the fractional   
   part:   
      
   =====================   
   print*, mod(3.14,1.0)   
   end   
   =====================   
      0.140000105   
      
      
   --   
   "...sois ouvert aux idées des autres pour peu qu'elles aillent dans le   
   même sens que les tiennes.", ST sur fr.bio.medecine   
   ST passe le mur du çon :    
      
   --- 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