floating point - How can I convert uint8_t and uint16_t into floats in c++? -


i read uint8_t , uint16_t types registers "cast" them floats.

wich optimal way?

there's no need cast; integer types implicitly convertible floating-point types.

uint8_t u8 = something; uint16_t u16 = whatever;  float f1 = u8; float f2 = u16; 

8 , 16-bit integer values should represented exactly. larger types might lose precision.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -