Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!sdd.hp.com!wuarchive!uunet!mcsun!unido!balu!gamber@cosmo.UUCP From: gamber@cosmo.UUCP (Johannes Teich) Newsgroups: comp.lang.forth Subject: ZenMath with funny results Keywords: ZenMath, Floating Point, ANS Forth Message-ID: <6753@balu.UUCP> Date: 19 May 91 21:03:49 GMT Sender: news@balu.UUCP Reply-To: gamber@cosmo.UUCP (Johannes Teich) Organization: CosmoNet, D-3000 Hannover 1, FRG Lines: 16 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]