"Frank Buss" <fb@[EMAIL PROTECTED]
> wrote in message
news:1g1ve2ygmuypw.13fkesny51zzi.dlg@[EMAIL PROTECTED]
> How do I redirect the output of f. to a string? It is just for testing,
so
> f. is sufficient. In the future would be nice to have a function for
better
> float formatting. Is there a general concept for redirecting the output
to
> strings, like e.g. possible in Java, Lisp, C++ etc.?
>
> REPRESENT looks a bit like I could use it, but it is more complicated. I
> just need a function where I can specify the number of digits after the
> decimal point, e.g. like the C function sprintf(buf, "%.3f", number). I
> need it for FICL, so I could implement it myself in C, but would be nice
to
> use Forth for it. Additional problem: FICL doesn't have REPRESENT.
Assuming you have (or can implement) a "standard" REPRESENT then
there is an output words package available.
ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/fpout22.f
Note: this is an "old" version, which I only recommend for systems
which have the standard REPRESENT and can't otherwise upgrade.
Source for a simple high-level REPRESENT can be found here. It
may help you get started. This also has been superceded so I don't
recommend it for new systems.
ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/Represent_11.txt


|