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!

FLOAT type number & Bytes 1

Status
Not open for further replies.

BM

Programmer
Apr 26, 2000
27
GB
Hi all,
Anyone know a good clean way of extracting a FLOAT type number from four bytes in byte array?
Thanks.

Barry
 
well... assuming that the byte array has the appropriate format of the bits try

union itof{
int i;
float f;
};

itof myItoF;

set the 4 bytes of the int in myItoF to the 4 bytes you have and then look at f

Matt
 
Hi Matt,
thanks for the reply, I will try that

Barry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top