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
Post a Comment