AnsweredAssumed Answered

vrf Real48 access in files

Question asked by VRFuser on Sep 11, 2002

I've actually done something like this....
I had data which was in the awful MS Compiled Basic Real format,
something like 5 or 7 bytes, and nothing like a standard.
If I recall, the Turbo reals have a pretty straight forward format.
What I did was look at some reals and figure out the parts, then read
them in as bytes, split them into parts, write them out as bytes again
to a temporary file and read them in as a real.  It sounds worse than
it is.  VEE has no way of "Casting" a variable, or accessing except as
the type it is.  The only way around that is to use a file

So what are parts?
Floating point numbers are stored in memory in 3 parts, sign, mantisa
and exponent.  Sign is generally 1 bit and stuck at one end of the
mantisa or exponent.  0 is generally positive.  Mantisa is the number,
multiplied or divided so that is it in a range of -1.0000 to 1.0000 or
something similar and exponent is the power of 2 to multiply the
mantisa by.  Exponents are often in offset binary.  Either the mantisa
or exponent may have implied 1s as the first bit....

for example 10 is really stored as 1 * 1.25 * 8
-0.25 is stored as -1 * 1 * 1/4

I'm doing all of this from memory, so I'm sure I'm off on some of the
details, but the concept is there.

If you are willing to wait till tomorrow, I can produce code that does
most of what you want.  I have VEE code to read an awful float in as
bytes, and dump it back out as a bytes, but in the form of a VEE real.
I also have code in Turbo that takes the Turbo real and chomps it into
and out of the awful real format, which will tell me (and you) the
Turbo format, and it is pretty straight forward then to see what is
what.  I even have a vee program that tests the conversions for a
range of numbers.

I don't have the code on me though.  I'll have it tomorrow.


You are currently subscribed to vrf as:
To subscribe send a blank email to "".
To unsubscribe send a blank email to "".
To send messages to this mailing list,  email "". 
If you need help with the mailing list send a message to "".