• You cannot know how many cells a floating-point number takes?

    From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Tue Oct 6 09:36:18 2026
    From Newsgroup: comp.lang.forth

    While doing some unrelated work, I bumped into this Gforth manual page:

    "5.6.2 Floating point stack

    Whilst every sane Forth has a separate floating-point stack, it is not strictly required; an ANS Forth system could theoretically keep
    floating-point numbers on the data stack."

    And here it comes: "As an additional difficulty, you don't know how many
    cells a floating-point number takes."

    Really? I mean -- I can see that such a program MIGHT have a
    environmental dependency (*), but given this:

    12.6.1.1556 FLOATS FLOATING
    ( n1 -- n2 )
    n2 is the size in *address units* of n1 floating-point numbers.

    6.1.0890 CELLS CORE
    ( n1 -- n2 )
    n2 is the size in address units of n1 cells.

    I mean, I tried this on Gforth -- and it gave me the answer:

    Gforth 0.7.9_20250321
    Authors: Anton Ertl, Bernd Paysan, Jens Wilke et al., for more type
    `authors'
    Copyright -- 2025 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later
    <https://gnu.org/licenses/gpl.html>
    Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
    Type `help' for basic help
    1 floats 1 cells /mod . . 1 0 ok

    So it told me -- without ANY doubt whatsoever, that the size of a FLOAT
    is equal to the size of a CELL.

    Anybody wants to comment on that?

    Hans Bezemer

    (*) Since I DO have an FP wordset that uses a shared stack, most of the
    time you temporarily move singles to the Return stack. You rarely (if
    ever) have to consider the size of an FP number. Either singles are out
    of sight BELOW the FP numbers -- or on top so you can move them out of
    the way when needed.

    I can't remember an single instance where I had to take the size of a
    float in consideration when doing stack acrobatics. ZEN floats cannot be
    moved to the Return stack, because that would make a program instantly non-portable.

    What I DO know is that I have plenty of routines that both work with the shared or the separate version -- like Ed's wonderful FP output routines.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Tue Oct 6 19:30:10 2026
    From Newsgroup: comp.lang.forth

    On 6/10/2026 6:36 pm, Hans Bezemer wrote:
    ...
    What I DO know is that I have plenty of routines that both work with the shared or the separate version -- like Ed's wonderful FP output routines.

    Thanks. I/O routines in particular aren't an issue as they mostly involve integers, and it's easy pushing integers on the return stack.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Tue Oct 6 12:27:28 2026
    From Newsgroup: comp.lang.forth

    On 10/6/2026 10:30 AM, dxf wrote:
    On 6/10/2026 6:36 pm, Hans Bezemer wrote:
    ...
    What I DO know is that I have plenty of routines that both work with the shared or the separate version -- like Ed's wonderful FP output routines.

    Thanks. I/O routines in particular aren't an issue as they mostly involve integers, and it's easy pushing integers on the return stack.

    Push an 80-bit integer?

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Tue Oct 6 12:32:47 2026
    From Newsgroup: comp.lang.forth

    On 10/6/2026 9:36 AM, Hans Bezemer wrote:

    So it told me -- without ANY doubt whatsoever, that the size of a FLOAT
    is equal to the size of a CELL.

    Anybody wants to comment on that?
    It may tell you the width of its *float stack*, but the items there can
    be a mix of SFLOAT, DFLOAT, and (probably not) extended floats.

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Tue Oct 6 11:23:00 2026
    From Newsgroup: comp.lang.forth

    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    And here it comes: "As an additional difficulty, you don't know how many >cells a floating-point number takes."
    ...
    I mean, I tried this on Gforth -- and it gave me the answer:

    Gforth 0.7.9_20250321
    Authors: Anton Ertl, Bernd Paysan, Jens Wilke et al., for more type >`authors'
    Copyright -- 2025 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later ><https://gnu.org/licenses/gpl.html>
    Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
    Type `help' for basic help
    1 floats 1 cells /mod . . 1 0 ok

    So you can find out how the sizes relate for this particular
    installation of Gforth. On the next installation of Gforth it can be different, even running on the same machine, for two installations of
    the same Gforth version compiled on the same machine:

    [mips:~:126402] ~/nfstmp/xxxgforthtest/c7/gcc-4.2/install/bin/gforth-0.7.0 -e "1 floats 1 cells /mod . . cr bye"
    1 0
    [mips:~:126403] ~/nfstmp/xxxgforthtest/c7-m32/gcc-4.2/install/bin/gforth-0.7.0 -e "1 floats 1 cells /mod . . cr bye"
    2 0

    For a different Forth system, you can get different answers:

    [mips:~:126404] sf64 "1 floats 1 cells /mod . . cr bye"
    1 2

    Or for different versions of the same Forth system:

    [mips:~:126405] vfx64 "1 floats 1 cells /mod . . cr bye"
    VFX Forth 64 5.43 [build 0199] 2023-11-09 for Linux x64
    -- MicroProcessor Engineering Ltd, 1998-2023
    1 2

    [mips:~:126406] vfx64-5.11 "1 floats 1 cells /mod . . cr bye"
    VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
    -- MicroProcessor Engineering Ltd, 1998-2021
    1 0

    So, unless you want to write a program for a single installation of a particular Forth system, you don't know. Certainly not in Gforth.
    And we certainly do not want to mislead programmers into writing
    programs that work on one installation of Gforth and fail on a
    different one.

    (*) Since I DO have an FP wordset that uses a shared stack, most of the
    time you temporarily move singles to the Return stack. You rarely (if
    ever) have to consider the size of an FP number. Either singles are out
    of sight BELOW the FP numbers -- or on top so you can move them out of
    the way when needed.

    Yes, moving the cells out of the way is one way (A) to work around the
    problems that a shared stack is encumbered with. Another (B) is to
    move the FP numbers out of the way. A third one (C) is to determine
    the width of FP numbers in stack cells, and then use PICK to access
    cells below FP numbers on the data stack. In the matrix
    multiplication code, we see several variants:

    Separate stack:

    : faxpy-nostride ( ra f_x f_y ucount -- )
    \ vy=ra*vx+vy
    0 ?do
    fdup over f@ f* dup f@ f+ dup f! float+ swap float+ swap
    loop
    2drop fdrop ;

    Shared stack variant using techniques B and C, by Joel Rees:

    fvariable faxpy-ra \ should be a user variable

    : faxpy-nostride ( ra f_x f_y ucount -- )
    \ vy=ra*vx+vy
    >r 2>r faxpy-ra f! 2r> r>
    0 ?DO ( f_x1 f_y1 )
    over f@ faxpy-ra f@ f*
    FPCELLWIDTH pick f@ f+
    FPCELLWIDTH pick f!
    float+ swap float+ swap
    LOOP
    2drop ;

    Shared stack variant using techniques A and B, by pahihu:

    fvariable faxpy-ra \ should be a user variable

    : faxpy-nostride ( ra f_x f_y ucount -- )
    \ vy=ra*vx+vy
    >r 2>r faxpy-ra f! 2r> r>
    0 ?DO ( f_x1 f_y1 )
    >R
    dup float+ swap f@
    faxpy-ra f@ f*
    R@ f@ f+ R@ f!
    R> float+
    LOOP
    2drop ;

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Tue Oct 6 08:37:33 2026
    From Newsgroup: comp.lang.forth

    On 10/6/26 2:36 AM, Hans Bezemer wrote:
    While doing some unrelated work, I bumped into this Gforth manual page:

    "5.6.2 Floating point stack

    Whilst every sane Forth has a separate floating-point stack, it is not strictly required; an ANS Forth system could theoretically keep floating-point numbers on the data stack."

    And here it comes: "As an additional difficulty, you don't know how many cells a floating-point number takes."

    Really? I mean -- I can see that such a program MIGHT have a
    environmental dependency (*), but given this:

    12.6.1.1556 FLOATS FLOATING
    ( n1 -- n2 )
    n2 is the size in *address units* of n1 floating-point numbers.

    6.1.0890 CELLS CORE
    ( n1 -- n2 )
    n2 is the size in address units of n1 cells.

    I mean, I tried this on Gforth -- and it gave me the answer:

    Gforth 0.7.9_20250321
    Authors: Anton Ertl, Bernd Paysan, Jens Wilke et al., for more type `authors'
    Copyright -- 2025 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/ gpl.html>
    Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
    Type `help' for basic help
    1 floats 1 cells /mod . . 1 0-a ok

    So it told me -- without ANY doubt whatsoever, that the size of a FLOAT
    is equal to the size of a CELL.

    Anybody wants to comment on that?


    One issue is that people will sometimes resort to use of temporary
    FVARIABLEs to get floating point numbers off the data stack. Then the
    word is not re-entrant.

    There is also the issue that, on average, there is more stack juggling required when fp numbers and single and double length numbers share the
    data stack. It is usually workable, but reduces the efficiency.


    --
    KM




    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Tue Oct 6 18:09:30 2026
    From Newsgroup: comp.lang.forth

    On 06-10-2026 15:37, Krishna Myneni wrote:
    One issue is that people will sometimes resort to use of temporary FVARIABLEs to get floating point numbers off the data stack. Then the
    word is not re-entrant.

    Not all words need to be reentrant -- so I don't consider this too big
    of a problem. Just a documentation issue. And if you really want to
    make things reentrant this completely free routine, offered to you by
    the "4tH compiler", will do:

    \ Typical allocation:
    \ CREATE MyStack 32 FLOATS CELL+ ALLOT

    \ The "extra" cell is required by the stack pointer.
    \ Typical initialization:
    \ MyStack FSTACK

    : float 1 FLOATS ;
    : fstack dup cell+ swap ! ; ( fstack --)
    : fs@ @ float - f@ ; ( fstack -- f)
    : >fs dup >r @ f! float r> +! ; ( f fstack --)
    : fs> >r float negate r@ +! r> @ f@ ; ( fstack -- f)
    : fsdepth dup @ swap - float / ; ( fstack -- n)

    There is also the issue that, on average, there is more stack juggling required when fp numbers and single and double length numbers share the
    data stack. It is usually workable, but reduces the efficiency.

    True. But that's how software works -- you either find this requirement
    the most important one, or that one ;-)

    Hans Bezemer


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Tue Oct 6 18:38:59 2026
    From Newsgroup: comp.lang.forth

    On 06-10-2026 12:32, marcel hendrix wrote:
    On 10/6/2026 9:36 AM, Hans Bezemer wrote:

    So it told me -- without ANY doubt whatsoever, that the size of a
    FLOAT is equal to the size of a CELL.

    Anybody wants to comment on that?
    It may tell you the width of its *float stack*, but the items there can
    be a mix of SFLOAT, DFLOAT, and (probably not) extended floats.

    -marcel

    That's not what the standard says:

    12.6.1.1556 FLOATS FLOATING
    ( n1 -- n2 )
    n2 is the size in *address units* of n1 floating-point numbers.

    Hans Bezemer
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Tue Oct 6 18:41:37 2026
    From Newsgroup: comp.lang.forth

    On 06-10-2026 12:27, marcel hendrix wrote:
    On 10/6/2026 10:30 AM, dxf wrote:
    Push an 80-bit integer?

    R >R >R >R >R >R >R >R >R >R

    Hans Bezemer
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Tue Oct 6 17:06:44 2026
    From Newsgroup: comp.lang.forth

    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    On 06-10-2026 12:32, marcel hendrix wrote:
    On 10/6/2026 9:36 AM, Hans Bezemer wrote:

    So it told me -- without ANY doubt whatsoever, that the size of a
    FLOAT is equal to the size of a CELL.

    Anybody wants to comment on that?
    It may tell you the width of its *float stack*, but the items there can
    be a mix of SFLOAT, DFLOAT, and (probably not) extended floats.

    -marcel

    That's not what the standard says:

    12.6.1.1556 FLOATS FLOATING
    ( n1 -- n2 )
    n2 is the size in *address units* of n1 floating-point numbers.

    Actually FLOATS tells you something about the number of address units
    (bytes) that n1 floats take in memory. It tells you nothing about the
    number of cells that a float takes on the data stack.

    The matrix multiplication code determines this hackishly with:

    :noname depth >r 0 0 d>f depth r> - >r fdrop r> ; execute
    constant FPCELLWIDTH

    Concerning different FP types, in the standard there is only one FP
    type on the FP stack (or, for systems with shared stacks, on the data
    stack), represented by r in stack diagrams. SF@ SF! DF@ DF! convert
    between the single on-stack FP type and the in-memory FP types, if
    necessary.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Tue Oct 6 20:08:41 2026
    From Newsgroup: comp.lang.forth

    On 10/6/2026 7:06 PM, Anton Ertl wrote:
    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    On 06-10-2026 12:32, marcel hendrix wrote:
    On 10/6/2026 9:36 AM, Hans Bezemer wrote:
    [..]
    It may tell you the width of its *float stack*, but the items there can
    be a mix of SFLOAT, DFLOAT, and (probably not) extended floats.

    -marcel
    ( Thunderbird thinks I wrote this, I did not)
    That's not what the standard says:

    12.6.1.1556 FLOATS FLOATING
    ( n1 -- n2 )
    n2 is the size in *address units* of n1 floating-point numbers.
    [..]
    Actually FLOATS tells you something about the number of address units
    (bytes) that n1 floats take in memory. It tells you nothing about the
    number of cells that a float takes on the data stack.

    Agreed. In iForth the floatstack is 16 bytes wide (not 10), as is an
    extended float (or now the new DXFLOAT and XDFLOAT). With 16 bytes it is
    also possible to put a "type complex" consisting of 2 double floats on
    the stack and in memory. Saving/retrieving floats to the R-stack will be
    a administrative nightmare.

    Concerning different FP types, in the standard there is only one FP
    type on the FP stack (or, for systems with shared stacks, on the data
    stack), represented by r in stack diagrams. SF@ SF! DF@ DF! convert
    between the single on-stack FP type and the in-memory FP types, if
    necessary.
    Except for the FFL, I have yet to see the first useful library that
    needs to know the size of the FP stack.

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Paul Rubin@no.email@nospam.invalid to comp.lang.forth on Tue Oct 6 13:13:16 2026
    From Newsgroup: comp.lang.forth

    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    1 floats 1 cells /mod . . 1 0 ok
    So it told me -- without ANY doubt whatsoever, that the size of a
    FLOAT is equal to the size of a CELL.

    That's on your specific installation, which might be 64-bit gforth. You
    could also try it with 32-bit gforth, which might still use 64-bit
    floats.

    In Forth-2012 I think the FP stack is mandated.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Wed Oct 7 12:05:44 2026
    From Newsgroup: comp.lang.forth

    On 6/10/2026 9:27 pm, marcel hendrix wrote:
    On 10/6/2026 10:30 AM, dxf wrote:
    On 6/10/2026 6:36 pm, Hans Bezemer wrote:
    ...
    What I DO know is that I have plenty of routines that both work with the shared or the separate version -- like Ed's wonderful FP output routines.

    Thanks.-a I/O routines in particular aren't an issue as they mostly involve >> integers, and it's easy pushing integers on the return stack.

    Push an 80-bit integer?

    If that's your 1 CELLS size why not?

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Wed Oct 7 13:24:42 2026
    From Newsgroup: comp.lang.forth

    On 7/10/2026 3:09 am, Hans Bezemer wrote:
    On 06-10-2026 15:37, Krishna Myneni wrote:
    One issue is that people will sometimes resort to use of temporary FVARIABLEs to get floating point numbers off the data stack. Then the word is not re-entrant.

    Not all words need to be reentrant -- so I don't consider this too big of a problem. Just a documentation issue. And if you really-a want to make things reentrant this completely free routine, offered to you by the "4tH compiler", will do:
    ...

    Let's not forget most systems use x87 hardware stack which is quite limited, forcing users to consider variables in any case. It's perhaps no surprise
    FSL implemented 'flocals' which notable fp users such as JVN improved upon
    and presumably used.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Wed Oct 7 13:47:35 2026
    From Newsgroup: comp.lang.forth

    On 7/10/2026 7:13 am, Paul Rubin wrote:
    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    1 floats 1 cells /mod . . 1 0 ok
    So it told me -- without ANY doubt whatsoever, that the size of a
    FLOAT is equal to the size of a CELL.

    That's on your specific installation, which might be 64-bit gforth. You could also try it with 32-bit gforth, which might still use 64-bit
    floats.

    In Forth-2012 I think the FP stack is mandated.

    "12.3.3 Floating-point stack
    A last in, first out list that shall be used by all floating-point operators."

    It's the nature of human fear that all systems tend to conformity, intolerance and outright suppression.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Wed Oct 7 06:30:13 2026
    From Newsgroup: comp.lang.forth

    marcel hendrix <mhx@iae.nl> writes:
    Except for the FFL, I have yet to see the first useful library that
    needs to know the size of the FP stack.

    My code for summing up an array needs an FP stack that is deeper than
    8 elements for all but the smalles arrays for SHIFT-REDUCE-SUM; for RECURSIVE-SUM, it checks the stack depth, and if it is small, the
    higher levels of the evaluation move intermediate results from the FP
    stack before calling the lower-level SUM<n> words which use up to 8 FP
    stack items.

    https://www.complang.tuwien.ac.at/forth/programs/pairwise-sum.4th

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Wed Oct 7 09:08:12 2026
    From Newsgroup: comp.lang.forth

    On 10/7/2026 3:05 AM, dxf wrote:
    On 6/10/2026 9:27 pm, marcel hendrix wrote:
    On 10/6/2026 10:30 AM, dxf wrote:
    [..]
    Push an 80-bit integer?

    If that's your 1 CELLS size why not?

    If One Size Fits All, it's great. I use, and mix, SFLOAT, DFLOAT XFLOAT
    and COMPLEX, and the arbitrary precision ones are in lists.

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Wed Oct 7 09:28:46 2026
    From Newsgroup: comp.lang.forth

    On 06-10-2026 19:06, Anton Ertl wrote:
    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    On 06-10-2026 12:32, marcel hendrix wrote:
    On 10/6/2026 9:36 AM, Hans Bezemer wrote:

    So it told me -- without ANY doubt whatsoever, that the size of a
    FLOAT is equal to the size of a CELL.

    Anybody wants to comment on that?
    It may tell you the width of its *float stack*, but the items there can
    be a mix of SFLOAT, DFLOAT, and (probably not) extended floats.

    -marcel

    That's not what the standard says:

    12.6.1.1556 FLOATS FLOATING
    ( n1 -- n2 )
    n2 is the size in *address units* of n1 floating-point numbers.

    Actually FLOATS tells you something about the number of address units
    (bytes) that n1 floats take in memory. It tells you nothing about the
    number of cells that a float takes on the data stack.

    The matrix multiplication code determines this hackishly with:

    :noname depth >r 0 0 d>f depth r> - >r fdrop r> ; execute
    constant FPCELLWIDTH

    Concerning different FP types, in the standard there is only one FP
    type on the FP stack (or, for systems with shared stacks, on the data
    stack), represented by r in stack diagrams. SF@ SF! DF@ DF! convert
    between the single on-stack FP type and the in-memory FP types, if
    necessary.

    - anton

    By that same way of reasoning, it is significant how much space a
    character takes up on the data stack. Wow, that's a whopping 64-bits on
    my system! If you **really** want to waste a lot of precision saving an
    FP to a variable why should that be of a concern to an implementer?

    Like I said, the most viable way to use a shared stack -- and produce
    portable code that works on both shared and separate stacks is to
    temporarily move integers to the return stack. Let's do crazy: create a separate stack for integers and move them there.

    Let's even go crazier: let conditional compilation figure it out -- and
    we've eradicated the problem all together, WHILE retaining the optimal
    speed for each architecture.

    But let's return to: "As an additional difficulty, you don't know how
    many cells a floating-point number takes."

    I think we can agree that we can determine (without a doubt) how much
    cells an FVARIABLE takes. Now, let's also assume someone still uses the
    data stack for FLOATS for some reason. You've demonstrated YOURSELF,
    it's quite trivial to figure that out.

    Well, fortunately I DO have such an insane version of the FP library
    that works from the data stack -- AND uses multiple cells per float:

    include lib/fp1.4th

    23 45 \ let's put some garbage on the datastack
    depth >r 0 s>f depth >r fdrop r> r> - . cr \ show value
    drop drop \ let's clean it up

    It returns 2. So, whatever you DO wanna count, I know how many cells
    there are in a float. I think that debunks "As an additional difficulty,
    you don't know how many cells a floating-point number takes" in every
    sense possible.

    Hans Bezemer


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Wed Oct 7 09:39:45 2026
    From Newsgroup: comp.lang.forth

    On 07-10-2026 04:47, dxf wrote:
    It's the nature of human fear that all systems tend to conformity, intolerance
    and outright suppression.

    "I am the rebel. I am the cause of all this trouble". Simply ignore it
    and keep close to ANS-94. Forth 2012 had this distinct "Forth-83" smell
    to it. The FP stack is just one of its abominations.

    Hans Bezemer

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Wed Oct 7 09:45:51 2026
    From Newsgroup: comp.lang.forth

    On 07-10-2026 04:47, dxf wrote:
    It's the nature of human fear that all systems tend to conformity, intolerance
    and outright suppression.

    "I am an outlaw, a shadow, a threat,
    A menace they look on with fear and regret.
    I walk in the margins, I break through the lines,
    AND I OWE NO ALLEGIANCE TO ANY DESIGNS."

    "The Outlaw" by Robert Service

    HB


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Wed Oct 7 10:11:44 2026
    From Newsgroup: comp.lang.forth

    On 06-10-2026 22:13, Paul Rubin wrote:
    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    1 floats 1 cells /mod . . 1 0 ok
    So it told me -- without ANY doubt whatsoever, that the size of a
    FLOAT is equal to the size of a CELL.

    That's on your specific installation, which might be 64-bit gforth. You could also try it with 32-bit gforth, which might still use 64-bit
    floats.

    In Forth-2012 I think the FP stack is mandated.

    Note this is what we're talking about:

    I bumped into this Gforth manual page:

    "5.6.2 Floating point stack

    Whilst every sane Forth has a separate floating-point stack, it is not strictly required; an ANS Forth system could theoretically keep
    floating-point numbers on the data stack."

    And here it comes: "As an additional difficulty, you don't know how many
    cells a floating-point number takes."

    Given Forth-2012, true, the FP stack is mandated. Which makes this
    paragraph moot to begin with:

    "12.3.3 Floating-point stack -- The floating-point stack shall be
    separate from the data and return stacks."

    But okay -- not everybody takes updating their manual that serious.

    And I never said that there should be fixed values attached to
    CELLS/FLOAT. I just claimed that the statement "As an additional
    difficulty, you don't know how many cells a floating-point number takes"
    is simply untrue. Whether the size of the FVARIABLE or the size of an FP
    item on a shared stack -- it can be known. You don't even have to
    manually maintain it, you can have the compiler figure it out at runtime.

    Hans Bezemer

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Wed Oct 7 08:26:12 2026
    From Newsgroup: comp.lang.forth

    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    I bumped into this Gforth manual page:

    "5.6.2 Floating point stack

    The manual of Gforth 0.7, which appeared in 2008, has such a section.

    Given Forth-2012, true, the FP stack is mandated. Which makes this
    paragraph moot to begin with

    But okay -- not everybody takes updating their manual that serious.

    If you want to look at the updated manual, here's the relevant section:

    https://net2o.de/gforth/Stack-Manipulation.html

    This says everything about how the stacks relate to each other, and if
    you want to look at the section formerly known as "5.6.2 Floating
    point stack", you click on the link to "Floating point stack".

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Wed Oct 7 11:41:03 2026
    From Newsgroup: comp.lang.forth

    On 07-10-2026 10:26, Anton Ertl wrote:
    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    I bumped into this Gforth manual page:

    "5.6.2 Floating point stack

    The manual of Gforth 0.7, which appeared in 2008, has such a section.

    Given Forth-2012, true, the FP stack is mandated. Which makes this
    paragraph moot to begin with

    But okay -- not everybody takes updating their manual that serious.

    If you want to look at the updated manual, here's the relevant section:

    https://net2o.de/gforth/Stack-Manipulation.html

    This says everything about how the stacks relate to each other, and if
    you want to look at the section formerly known as "5.6.2 Floating
    point stack", you click on the link to "Floating point stack".

    - anton

    Well, how many "official" Gforth manuals are there?!

    https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Floating-point-stack.html
    https://gforth.org/manual/Floating-point-stack.html https://forth-ev.de/wiki/res/lib/exe/fetch.php/projects:gforth-android:gforth-ebook.pdf
    https://www.scribd.com/document/395446065/gforth-2018-11-23

    Obvious, you might argue that the last two are obviously third parties
    who offer the manual, but does 'https://net2o.de/gforth/Stack-Manipulation.html' automatically strike
    you as "the" official site?

    Hans Bezemer
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Wed Oct 7 12:43:38 2026
    From Newsgroup: comp.lang.forth

    On 10/7/2026 8:30 AM, Anton Ertl wrote:
    marcel hendrix <mhx@iae.nl> writes:
    Except for the FFL, I have yet to see the first useful library that
    needs to know the size of the FP stack.

    My code for summing up an array needs an FP stack that is deeper than
    8 elements for all but the smalles arrays for SHIFT-REDUCE-SUM; for RECURSIVE-SUM, it checks the stack depth, and if it is small, the
    higher levels of the evaluation move intermediate results from the FP
    stack before calling the lower-level SUM<n> words which use up to 8 FP
    stack items.

    https://www.complang.tuwien.ac.at/forth/programs/pairwise-sum.4th


    Did you check if it speeds up the NORMAL() algorithm in the mm.frt
    benchmark?

    -marcel

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Wed Oct 7 10:21:40 2026
    From Newsgroup: comp.lang.forth

    Hans Bezemer <the.beez.speaks@gmail.com> writes:
    Well, how many "official" Gforth manuals are there?!

    The ones that are delivered with the various releases and snapshots
    are official (although, for the snapshots, the manual sometimes is not up-to-date wrt. the implementation; but for the current snapshot, they
    are).

    What I have seen on the web are the HTML versions of manuals for
    various releases or snapshots. If you are on one page of a HTML
    version, click on the [Contents] link at the top of the page, or, if
    that does not exist, repeatedly on the "Up:" link, and then scroll up,
    or down and it will tell you for which version of Gforth this manual
    is, in a sentence starting with "This manual is for Gforth (version".

    I have not yet seen any fake manuals for Gforth, so, for now, you
    probably do not have to worry about whether a web version is official,
    just about which version of Gforth it documents.

    https://gforth.org/manual/Floating-point-stack.html

    Note that the "Manual" link at gforth.org links to
    <https://net2o.de/gforth/>. <https://gforth.org/manual/> currently is
    for version 0.7.9_20180815; Gerald does not keep the manual up-to-dat,
    that's why the link points to net2o.de, where the manual is pretty
    up-to-date to the latest snapshot.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Wed Oct 7 11:01:53 2026
    From Newsgroup: comp.lang.forth

    marcel hendrix <mhx@iae.nl> writes:
    On 10/7/2026 8:30 AM, Anton Ertl wrote:
    marcel hendrix <mhx@iae.nl> writes:
    Except for the FFL, I have yet to see the first useful library that
    needs to know the size of the FP stack.

    My code for summing up an array needs an FP stack that is deeper than
    8 elements for all but the smalles arrays for SHIFT-REDUCE-SUM; for
    RECURSIVE-SUM, it checks the stack depth, and if it is small, the
    higher levels of the evaluation move intermediate results from the FP
    stack before calling the lower-level SUM<n> words which use up to 8 FP
    stack items.

    https://www.complang.tuwien.ac.at/forth/programs/pairwise-sum.4th


    Did you check if it speeds up the NORMAL() algorithm in the mm.frt >benchmark?

    No. I did check the performance of summing up arrays <2025Jul16.132504@mips.complang.tuwien.ac.at>. One can use the
    pairwise sum technique for speeding up DDOT, and thus the "normal"
    matrix multiplication algorithm.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Wed Oct 7 20:41:45 2026
    From Newsgroup: comp.lang.forth

    marcel hendrix <mhx@iae.nl> writes:
    On 10/7/2026 8:30 AM, Anton Ertl wrote:
    https://www.complang.tuwien.ac.at/forth/programs/pairwise-sum.4th


    Did you check if it speeds up the NORMAL() algorithm in the mm.frt >benchmark?

    The "normal algorithm" suffers from bad spacial locality, leading to
    TLB (and maybe cache) thrashing. The benefits of pairwise addition in
    DDOT probably vanish in the TLB and cache misses caused by the "normal algorithm".

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2