• Number Literal Syntax

    From Lawrence D'Oliveiro@ldo@nz.invalid to comp.lang.fortran on Sat Feb 24 05:52:01 2024
    From Newsgroup: comp.lang.fortran

    I see that Fortran uses the underscore in integer and real literals as a special suffix delimiter, followed by a code number or name to indicate
    the type of the literal. Pity they didn’t follow the convention in some other languages, where this is ignored so it can be used as a grouping delimiter, just for readability, to avoid the “drowning in digits” effect. E.g. in Python this is a valid integer literal

    18_446_744_073_709_551_615

    and this is a valid real literal:

    3.141_592_653_589_793
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From =?UTF-8?Q?m=5Fb=5Fmetcalf?=@michaelmetcalf@compuserve.com to comp.lang.fortran on Sat Feb 24 09:17:51 2024
    From Newsgroup: comp.lang.fortran

    Le 24/02/2024 à 06:52, Lawrence D'Oliveiro a écrit :
    I see that Fortran uses the underscore in integer and real literals as a special suffix delimiter, followed by a code number or name to indicate
    the type of the literal. Pity they didn’t follow the convention in some other languages, where this is ignored so it can be used as a grouping delimiter, just for readability, to avoid the “drowning in digits” effect.
    E.g. in Python this is a valid integer literal

    18_446_744_073_709_551_615

    and this is a valid real literal:

    3.141_592_653_589_793

    Well, whatever the merits of this may be, I don't believe that, back in
    the mid-1980s when Fortran 90 was more-or-less defined, there was any 'convention' to follow. Python, for instance, was released only in 1991.

    Regards,

    Mike
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Gary Scott@garylscott@sbcglobal.net to comp.lang.fortran on Sat Feb 24 12:40:37 2024
    From Newsgroup: comp.lang.fortran

    On 2/23/2024 11:52 PM, Lawrence D'Oliveiro wrote:
    I see that Fortran uses the underscore in integer and real literals as a special suffix delimiter, followed by a code number or name to indicate
    the type of the literal. Pity they didn’t follow the convention in some other languages, where this is ignored so it can be used as a grouping delimiter, just for readability, to avoid the “drowning in digits” effect.
    E.g. in Python this is a valid integer literal

    18_446_744_073_709_551_615

    and this is a valid real literal:

    3.141_592_653_589_793

    In fixed form, probably 3.141 592 653 589 793

    might have worked

    I don't find this "drowning" problem to be a problem. In any case, the
    common symbol for grouping numbers is the comma, although not typically
    after the decimal point.

    Sorry for the direct email sent to MM. Thunderbird changed the menu
    such that the first option (reply (meaning reply to sender, not reply))
    goes to email and the second option "followup" goes to group. I think
    that's dumb, but you'd think I could remember it from one post to the
    next :(
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.lang.fortran on Sat Feb 24 21:13:53 2024
    From Newsgroup: comp.lang.fortran

    On Sat, 24 Feb 24 09:17:51 +0000, m_b_metcalf wrote:

    Well, whatever the merits of this may be, I don't believe that, back in
    the mid-1980s when Fortran 90 was more-or-less defined, there was any 'convention' to follow.

    Ada was probably the language that pioneered it.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Thomas Koenig@tkoenig@netcologne.de to comp.lang.fortran on Sun Feb 25 18:57:13 2024
    From Newsgroup: comp.lang.fortran

    Lawrence D'Oliveiro <ldo@nz.invalid> schrieb:
    I see that Fortran uses the underscore in integer and real literals as a special suffix delimiter, followed by a code number or name to indicate
    the type of the literal. Pity they didn’t follow the convention in some other languages,

    That would, I belive, have required a time machine. The other
    languages could have followed Fortran: Fortran still has such a
    method: Blanks are not significant in fixed form, so

    a = 123.456 789

    is perfectly legal. It would be possible to introduce that into free
    form without too much hassle.

    So, I think we should ask latecomers like Python to change.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.lang.fortran on Sun Feb 25 20:21:27 2024
    From Newsgroup: comp.lang.fortran

    On Sun, 25 Feb 2024 18:57:13 -0000 (UTC), Thomas Koenig wrote:

    So, I think we should ask latecomers like Python to change.

    Python could. It already has implicit concatenation of string literals; it could do the same for numerics.
    --- Synchronet 3.20a-Linux NewsLink 1.114