12-10-2012 04:17 AM
Hi,
is there built-in function of Labwindows to convert double into array of IEEE 754 (or hex???, i am not so sure)
Like this:
Double Hex array
40 00 00 42 20
40.5 00 00 42 22
40.8 33 33 42 23
Thank,
(PS: the hex arraies above are calc by Type-Casting in Labview)
Solved! Go to Solution.
12-10-2012 05:18 AM
Sorry guys
i made a mistake between IEEE 754, hex, float, double
Here is the question:
I have a float-value (IEEE754) in labwindows, How can i convert it into unsigned int?
Would it be easier, if i use double instead of float?
12-10-2012 08:16 AM
As far as I can tell, there is no built in function in LabWindows to do that, so you'll have to use what's available in C. The two ways I know of is to use pointers to cast the pointer to the float value as a pointer to an unsigned int type and then retrieve the value as such:
float f = 40.0f; unsigned int u; u = *((unsigned int *)&f);
The other way is to use unions, which may be more convienent if you have to do this a lot.
union ex32 { float fval; unsigned int uval; }; float f = 40.0f; unsigned int u; union ex32 t; t.fval = f; u = t.uval;
12-12-2012 01:45 AM
Thank tstanley, u saved my day 😄