With the code...

FVARIABLE XFVARIABLE Y
FVARIABLE Z
FVARIABLE T
FVARIABLE L
: D_RPNS ( -- )        \  print out Stack ONLY for debugging purpose
    CR
    ." X " X F@ F. CR
    ." Y " Y F@ F. CR
    ." Z " Z F@ F. CR
    ." T " T F@ F. CR
    ." L " L F@ F. CR
    CR
    F.S
    CR 

: TEST ( -- )    CLEARSTACK
    2.0e FDUP Y F!
    CR D_RPNS
    5.0e FDUP X F!
    CR ." Test function prior start PERE12" D_RPNS
    ;

The Terminal output is..
test 

X 0. 
Y 2. 
Z 0. 
T 0. 
L 0. 

<2> 1.000000000000E0 2.000000000000E0 

Test function prior start PERE12
X 5. 
Y 2. 
Z 0. 
T 0. 
L 0. 

<3> 1.000000000000E0 2.000000000000E0 5.000000000000E0 


Where is the 1.000000000000E0  coming from? Is it a bug? It can be deleted from 
the stack with FNIP. But for me this is weird FNIP must be used to delete a 
number which appeared in the stack.

Then it turns to be ok

: TEST ( -- )
    CLEARSTACK
    2.0e FDUP Y F!
    FNIP
    CR D_RPNS
    5.0e FDUP X F!
    CR ." Test function prior start PERE12" D_RPNS
    ;

then the output is fine,,,

test 

X 0. 
Y 2. 
Z 0. 
T 0. 
L 0. 

<1> 2.000000000000E0 

Test function prior start PERE12
X 5. 
Y 2. 
Z 0. 
T 0. 
L 0. 

<2> 2.000000000000E0 5.000000000000E0 



gforth 0.7.3 fromDebian 11.
uname -a
Linux ProDesk 5.10.0-23-amd64 #1 SMP Debian 5.10.179-1 (2023-05-12) x86_64 
GNU/Linux
apt list gforth
Listing... Done
gforth/stable,now 0.7.3+dfsg-9+b1 amd64 [installed]
gforth/stable 0.7.3+dfsg-9+b1 i386


Any remark / comment is welcome.
  

Reply via email to