Next: Return stack, Previous: Data stack, Up: Stack Manipulation
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. As an additional difficulty, you don't know how many cells a floating-point number takes. It is reportedly possible to write words in a way that they work also for a unified stack model, but we do not recommend trying it. Instead, just say that your program has an environmental dependency on a separate floating-point stack.
floating-stack– n environment “floating-stack”
n is non-zero, showing that Gforth maintains a separate floating-point stack of depth n.
fdropr – float “f-drop”
fnipr1 r2 – r2 gforth “f-nip”
fdupr – r r float “f-dupe”
foverr1 r2 – r1 r2 r1 float “f-over”
ftuckr1 r2 – r2 r1 r2 gforth “f-tuck”
fswapr1 r2 – r2 r1 float “f-swap”
fpickf:... u – f:... r gforth “fpick”
Actually the stack effect is
r0 ... ru u -- r0 ... ru r0 .
frotr1 r2 r3 – r2 r3 r1 float “f-rote”