Helena,
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
intermediary.
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.
lBill
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
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
intermediary.
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.
lBill
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
Being forced to access old data files created by Turbo Pascal with known
file structure, I'm trying to access the data with HP VEE. Relatively
simple task except...
Turbo Pascal provides five predefined real types. Each type has a specific
range and precision:
Type Range Digits Bytes
_________________________________________________
real 2.9e-39..1.7e38 11-12 6
single 1.5e-45..3.4e38 7-8 4
double 5.0e-324..1.7e308 15-16 8
extended 3.4e-4932..1.1e4932 19-20 10
comp -9.2e18..9.2e18 19-20 8
The HP VEE on the other hand has
Real64 (8 Bytes):
Real (or Real64) is a 64-bit real that conforms to the IEEE 754 standard
(approximately 16 significant decimal digits or 1.7976931348623157E308).
and Real32(4 Bytes):
Real32 is a 32-bit real that conforms to the IEEE 754 standard
(3.40282347E38).
Anyone knows how to access the data from the file created in the Pascal
"real(6 Byte)" = Real40 format and/or how to calculate the real number if
accessed by HP VEE Byte format ?
------------------
Helena Frndova, MEng.
Research Technologist
Department of Critical Care Medicine
Hospital for Sick Children
555 University Avenue
Toronto, Canada, M5G 1X8
phone: (416) 813-5215
fax: (416) 813-7299
email: hfrndova@sickkids.ca
helena.frndova@utoronto.ca
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".