Hi Folks,
I hope this is an easy one to solve but I'm having trouble converting a long into a float. From what I've been able to glean from the docs a long and float are both 32 bits. Using the debugger I can see that if I assign 0.12345 to a variable the hex value is 0x3DFCD35B. And if I assign the same number to the long the debugger shows the same hex value as the float.
So, the question is - how do I convert the long into the float? Casting the long to float isn't working.
float myTestData; int32_t numToTest; numToTest = 0x3dfcd35b; // equal to 0.12345 myTestData = (float)numToTest;
Using the debugger, myTestData ends up equal to 0x4E77F34D which is 1.316484e+09 and not the expected hex value of 0x3DFCD35B. What do I need to change to get this working?
Thanks,
Richard Cooke