[comp.lang.forth] ZenMath with funny results

gamber@cosmo.UUCP (Johannes Teich) (05/20/91)

Trying Martin Tracy's beautiful one-screen ZenMath (Dr. Dobb's Toolbook II)
with ZEN 15alpha I only had to change ASCII to [CHAR] to get it running.
 
+--------------------------------+ +-------------------+---------+
!              Input             ! ! Stack before outp.!  Output !
+--------------------------------+ +-------------------+---------+
! 3.1416 FLOAT  1.5 FLOAT  F* F. ! !     4712   -3     !  4.712  !
!   -17. FLOAT -4.5 FLOAT  F+ F. ! !     -215   -1     ! -21.5   !
!     1. FLOAT   3. FLOAT  F/ F. ! !    23210  -12     !  0.000000023210
+--------------------------------+ +-------------------+---------+
 
The last result is a little queer, but the prelude ": D2*  2DUP D+ ;"
repaired it to "0.3333". I found that the primitives D2* and D2/ don't
clear the carry flag before shifting the AX register.
 
  --Hannes Teich                         [reply to: jgt@bbs.forth-ev.de]