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

sql - Postgresql error: "failed to find conversion function from unknown to text" -

javascript - Why in IE loading image not show at center bottom of page? -

Phantomjs login, redirect and render page after pageLoad finishes -