Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Byte[] to double.

Status
Not open for further replies.

stevenk140

Programmer
Nov 20, 2003
34
CA
I have an array of bytes which should make up a double.

double val;

byte[] doub = new byte[8];

doub[0] = arraybytes[20];
doub[1] = arraybytes[21];
doub[2] = arraybytes[22];
doub[3] = arraybytes[23];
doub[4] = arraybytes[24];
doub[5] = arraybytes[25];
doub[6] = arraybytes[26];
doub[7] = arraybytes[27];

val = doub;

This code does not work. How can I convert my byte[] doub into a double?

Steven

 
Alternatively, since you are pulling the information from another array:

Code:
val = BitConverter.ToDouble( arraybytes, 20 );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top