• Is there any way to specify an octal number in Tcl 9.0?

    From Choosechee@choosechee@pm.me to comp.lang.tcl on Tue Mar 24 22:24:30 2026
    From Newsgroup: comp.lang.tcl

    So, in Tcl 8.6, a number starting with 0 being interpreted as an octal
    number was removed. From my understanding, there is now not a way to
    specify a number that will be interpreted as octal. Is this correct? I'm trying to write something like JSON, but based on Tcl instead of
    JavaScript, so I need to know exactly what number formats are supported.
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Wed Mar 25 07:31:49 2026
    From Newsgroup: comp.lang.tcl

    Am 25.03.2026 um 04:24 schrieb Choosechee:
    So, in Tcl 8.6, a number starting with 0 being interpreted as an octal number was removed. From my understanding, there is now not a way to
    specify a number that will be interpreted as octal. Is this correct? I'm trying to write something like JSON, but based on Tcl instead of
    JavaScript, so I need to know exactly what number formats are supported.

    Use "0o" prefix.

    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Ralf Fassel@ralfixx@gmx.de to comp.lang.tcl on Wed Mar 25 10:42:14 2026
    From Newsgroup: comp.lang.tcl

    * Choosechee <choosechee@pm.me>
    | [...] so I need to know exactly what number formats are supported.

    See
    https://www.tcl-lang.org/man/tcl9.0/TclCmd/expr.html#M6

    [expr] manpage, subsection "Operands/numeric value"

    numeric value
    Either integer or floating-point. The first two characters of an
    integer may also be 0d for decimal, 0b for binary, 0o for octal
    or 0x for hexadecimal.

    A floating-point number may be take any of several common
    decimal formats, and may use the decimal point ., e or E for
    scientific notation, and the sign characters + and -.
    [...]

    HTH
    R'
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Don Porter@donald.porter@nist.gov to comp.lang.tcl on Wed Mar 25 08:30:56 2026
    From Newsgroup: comp.lang.tcl

    On 3/25/26 05:42, Ralf Fassel wrote:
    * Choosechee <choosechee@pm.me>
    | [...] so I need to know exactly what number formats are supported.

    See
    https://www.tcl-lang.org/man/tcl9.0/TclCmd/expr.html#M6

    [expr] manpage, subsection "Operands/numeric value"

    numeric value
    Either integer or floating-point. The first two characters of an
    integer may also be 0d for decimal, 0b for binary, 0o for octal
    or 0x for hexadecimal.

    Worth mentioning that Tcl has understood the 0o prefix since Tcl 8.5.0,
    so your scripts can use it in the confidence that it will function in
    any installed Tcl you are likely to find.
    --
    | Don Porter Applied and Computational Mathematics Division |
    | donald.porter@nist.gov Information Technology Laboratory |
    | http://math.nist.gov/~DPorter/ NIST | |______________________________________________________________________|
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Choosechee@choosechee@pm.me to comp.lang.tcl on Wed Mar 25 10:32:22 2026
    From Newsgroup: comp.lang.tcl

    On 3/24/26 22:24, Choosechee wrote:
    So, in Tcl 8.6, a number starting with 0 being interpreted as an octal number was removed. From my understanding, there is now not a way to
    specify a number that will be interpreted as octal. Is this correct? I'm trying to write something like JSON, but based on Tcl instead of
    JavaScript, so I need to know exactly what number formats are supported.
    Thanks to everyone for the help!
    --- Synchronet 3.21f-Linux NewsLink 1.2