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

    From Choosechee@[email protected] 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@[email protected] 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@[email protected] to comp.lang.tcl on Wed Mar 25 10:42:14 2026
    From Newsgroup: comp.lang.tcl

    * Choosechee <[email protected]>
    | [...] 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@[email protected] 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 <[email protected]>
    | [...] 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 |
    | [email protected] Information Technology Laboratory |
    | http://math.nist.gov/~DPorter/ NIST | |______________________________________________________________________|
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Choosechee@[email protected] 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