Hi guys,
I need to convert a 32 bit value(long) to a 32 bit float. Unfortunately there is no itof function in C and wikipedia does not give a simple solution.
Casting simply does not do the conversion correctly, is there a simple way of doing this conversion?
Thanks
C will automatically convert from an integer to a float.
What do you say "does not do the conversion correctly"?
Note that a 32-bit float has a larger supported range, but instead has a smaller resolution, i.e. all values in a 32-bit integer will not be possible to represent in a 32-bit float - some integer values will be rounded to another integer value.