On Sunday 09 April 2006 03:58, Sergey Plis wrote: > Hi! > > I have trouble with figuring out floating point to string conversion > under xbigforth. Floating points calculations happen smoothly, but > when I need to output what I'm doing I have trouble. In the attached > little program only one thing is happening when you press its only > button: the program outputs what's on the floating stack using word > "f." and I put !1 on the stack. However, all it outputs is zeros. I > think the problem is with the conversion semantics of f., but have no > idea what word conflict under MINOS prevents it from working. If > somebody knows a solution I'd really appreciate if you share. If it > is a bug I'll be happy when it is fixed.
You have to use set-precision before - the event handling task has this set to 0 initially, so it won't output any significant digit. The attached file works when invoked with xbigforth -e "import float float also" problem.m -- Bernd Paysan "If you want it done right, you have to do it yourself" http://www.jwdt.com/~paysan/
#! xbigforth
\ automatic generated code
\ do not edit
also editor also minos also forth
component class comp0000
public:
early widget
early open
early dialog
early open-app
( [varstart] ) ( [varend] )
how:
: open new DF[ 0 ]DF s" No Title" open-component ;
: dialog new DF[ 0 ]DF s" No Title" open-dialog ;
: open-app new DF[ 0 ]DF s" No Title" open-application ;
class;
comp0000 implements
( [methodstart] ) ( [methodend] )
: widget ( [dumpstart] )
^^ S[ 6 set-precision !1 f. cr ]S ( MINOS ) TT" does not do what it says" S" print floating point number" button new
&1 vabox new panel
( [dumpend] ) ;
: init ^>^^ assign widget 1 super init ;
class;
: main
comp0000 open-app
$1 0 ?DO stop LOOP bye ;
script? [IF] main [THEN]
previous previous previous
pgpcYfLlN8Ywu.pgp
Description: PGP signature
