converting floating point dtaa from byte array to DOUBLE 
Author Message
 converting floating point dtaa from byte array to DOUBLE

I am reading a file into a BYTE array from which it is being parsed.
Within this file are
a number of data type (i.e., longs, integers, etc.) that I am able to
convert from sections
of the byte array to their data types correctly.  My problem is in trying
to do this for the
double precision floating point numbers.  Any assistance or guidance would
be most appreciated.



Sat, 22 Jul 2000 03:00:00 GMT  
 converting floating point dtaa from byte array to DOUBLE

Quote:

> I am reading a file into a BYTE array from which it is being parsed.
> Within this file are
> a number of data type (i.e., longs, integers, etc.) that I am able to
> convert from sections
> of the byte array to their data types correctly.  My problem is in trying
> to do this for the
> double precision floating point numbers.  Any assistance or guidance would
> be most appreciated.

you need to know how the real numbers are stored ( formatted ). Most
systems use IEEE format for storing reals but not all VMS for instance
has several formats that can be used for storing real numbers. There are
several articles on the MS knowledge base that discuss the IEEE format
and how to convert bytes to a real number in human format.


Sat, 22 Jul 2000 03:00:00 GMT  
 converting floating point dtaa from byte array to DOUBLE

Quote:

> I am reading a file into a BYTE array from which it is being parsed.
> Within this file are
> a number of data type (i.e., longs, integers, etc.) that I am able to
> convert from sections
> of the byte array to their data types correctly.  My problem is in trying
> to do this for the
> double precision floating point numbers.

You must use the CopyMemory function (aka RtlMoveMemory) to copy from the
byte array to a Double. Say the data is in myArray(4), you can do:
   Dim myDouble As Double
   CopyMemory myArray(4), myDouble, 8

For Single variables, the last parameter is 4:
   Dim mySingle As Single
   CopyMemory myArray(4), mySingle, 4



Wed, 26 Jul 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Byte representation of single and double floating point types

2. Converting floating point number to IEEE 32-bit precision floating point format

3. QBasic MBF Double Conversion to VB6 Floating Point Double

4. Convert byte array to double? VB5.0

5. Convert Byte Array To Double

6. Convert Byte Array to Double.

7. Convert Byte Array to Double using CopyMemory

8. Converting floating number to the IEEE 32/40-bit precision floating point format

9. Need to convert a 16 byte array of bytes to 4 byte integer

10. Floating point conversion problem (Single to Double)

11. Code for converting decimal floating point numbers in VB6

12. convert a 32 bits IEEE floating point

 

 
Powered by phpBB® Forum Software