...
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.
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.
So it told me -- without ANY doubt whatsoever, that the size of a FLOATIt may tell you the width of its *float stack*, but the items there can
is equal to the size of a CELL.
Anybody wants to comment on that?
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
(*) 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.
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.
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
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?
be a mix of SFLOAT, DFLOAT, and (probably not) extended floats.
-marcel
On 10/6/2026 10:30 AM, dxf wrote:
Push an 80-bit integer?
R >R >R >R >R >R >R >R >R >R
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
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?
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 <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:
( Thunderbird thinks I wrote this, I did not)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.
Concerning different FP types, in the standard there is only one FPExcept for the FFL, I have yet to see the first useful library that
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.
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.
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?
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:
...
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.
Except for the FFL, I have yet to see the first useful library that
needs to know the size of the FP stack.
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?
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
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?
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
It's the nature of human fear that all systems tend to conformity, intolerance
and outright suppression.
It's the nature of human fear that all systems tend to conformity, intolerance
and outright suppression.
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.
I bumped into this Gforth manual page:
"5.6.2 Floating point stack
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.
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
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
Well, how many "official" Gforth manuals are there?!
https://gforth.org/manual/Floating-point-stack.html
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?
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?
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 76 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 55:03:18 |
| Calls: | 1,265 |
| Calls today: | 1 |
| Files: | 1,362 |
| D/L today: |
3 files (2,684K bytes) |
| Messages: | 285,585 |