LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert IEEE-754 32-bit float to Hexadecimal

Solved!
Go to solution

Can you give us a typical string and the value you expect from it?

 

You possibly also need to worry about byte order (big vs little endian).

0 Kudos
Message 11 of 14
(3,417 Views)

Hi,

 

This is the data read from the buffer but displayed as Hex '0103 0427 D241 C1A1 7E'. I'm currently using:

 

1) a 'String to Byte Array' then

2) push it through a 'To Double Precision Float' then

3) go through two 'Array Subset' to pull the data that I wanted (which is really 27D2 and 41C1) then

4) convert each array to cluster and extract each element, after that

5) need to calculate/convert the data that I wanted to a float.

 

41C1 is the high word and 27D2 is the low word.

 

Suppose to use the high and low word to get the SIGN, EXPONENT and MANTISSA and use those to calculate the float which in this case should be 24.14444351.

 

I know this is really a very long process but I have not figured out the easy way yet.

 

 

0 Kudos
Message 12 of 14
(3,411 Views)
Solution
Accepted by topic author ksin

Try this:

 

(string subset, typecast to U32, swap words, typecast to SGL)
Message Edited by altenbach on 07-14-2009 08:52 AM
Message 13 of 14
(3,407 Views)
That works great! Thanks! Really appreciate it!
0 Kudos
Message 14 of 14
(3,391 Views)