On Mar 23, 12:08 am, Larry Webber <theco...@[EMAIL PROTECTED]
> wrote:
> On Sat, 22 Mar 2008 19:28:34 -0700, Bruce McFarling wrote:
> > On Mar 22, 7:57 pm, Larry Webber <theco...@[EMAIL PROTECTED]
> wrote:
> >> I am using both gforth and an alpha release of vfxlin forth. What is
> >> the recommended way of writing floating point values to a file? For
> >> writing integer values there are the "pictured number conversion"
> >> words. What is the recommended ****table way to do this with gforth
and
> >> vfxlin?
>
> > Not because I know the answer, but because I'm interested in hearing
it:
>
> > (1) Are you asking about writing a text string representing the
floating
> > point value for later display?
>
> > (2) Or are you asking about writing a floating point value in binary
> > form for later retrieval and computation?
>
> Bruce,
>
> The latter. The need is to write floating point values to a file. The
> data will later be read by a mathematical program which will both plot
> the values and perform certain numerical analysis on the data.
>
> A friend was able to "get under the hood" of gforth and figure out how
to
> vector the output to a file but we would like a more straight forward
> method which is implementation neutral. I don't see a straightforward
way
> of doing this presently.
If it sup****ts the IEEE standard floats, it seems like using DF! (64-
bit) or SF! (32-bit) to store directly to a binary file buffer would
be the most straightforward ... if a program can read binary floating
point data, it will ought to be able to read IEEE standard floats.
If I was trying it, I'd put the format and any other side information
in a parallel text data file, so that the binary file is a pure array
or matrix of binary floating point data.
If putting together a text data file of floating point values,
REPRESENT gets the significand into a text buffer (handed to the
word), and returns the exponent as an integer (along with a success
flag and a flag for the sign of the value) which can be converted to a
string as ordinary pictured numeric output.


|