jordanking
Programmer
- Sep 8, 2005
- 351
Hello,
I have a byte array of 8 bytes in length that is supposed to contain the binary of a Double data type. The official SDK documentaion for the data says that it is a "8 byte IEEE long real". It comes from a recordset given by an external database(not access). I cannot extract the double number. I want to be able to "see" what the double number is. I have isolated the byte array by using the copyMemory API and then chopping the data into its respective fields. The other character encoding of the recordset is ASCII Decimal, I don't know if that matters.
Here is some code:
This is what the code returns:
0 0 0 0 0 240 191 0
or
00002401910
If I pass this number or the byte array (as data) to a double data type variable it returnsthe following. The value is supposed to be "5000" which I know for sure.
3.60745707139629E-313
It returns this regardle of what bytes or numbers I pass to it. There might be an easy function that does this, I found functions in VB that were close, can they be called in VBA?
Basically I am unsure how to work with double number formats from binary byte arrays.
Thanks in advance
J.K.
I have a byte array of 8 bytes in length that is supposed to contain the binary of a Double data type. The official SDK documentaion for the data says that it is a "8 byte IEEE long real". It comes from a recordset given by an external database(not access). I cannot extract the double number. I want to be able to "see" what the double number is. I have isolated the byte array by using the copyMemory API and then chopping the data into its respective fields. The other character encoding of the recordset is ASCII Decimal, I don't know if that matters.
Here is some code:
Code:
Call CopyMemory(pField.Data(0), pRecord.Data(558), 8)
With pField
For i = 1 To 8
abytTemp = pField.Data(i)
strTemp = abytTemp
strOutput = strOutput & " " & strTemp
Next
Debug.Print strOutput
End With
This is what the code returns:
0 0 0 0 0 240 191 0
or
00002401910
If I pass this number or the byte array (as data) to a double data type variable it returnsthe following. The value is supposed to be "5000" which I know for sure.
3.60745707139629E-313
It returns this regardle of what bytes or numbers I pass to it. There might be an easy function that does this, I found functions in VB that were close, can they be called in VBA?
Basically I am unsure how to work with double number formats from binary byte arrays.
Thanks in advance
J.K.