IEEE-754 Float to int

Lucas Tanure tanure at linux.com
Tue Nov 22 11:05:18 EST 2016


Hi,

At some point my hardware gives me a 32bit IEEE-754 float, like this :

regmap_read(device->regmap, ADDR0, &temp);

value = temp << 16;

regmap_read(device->regmap, ADDR1, &temp);

value |= temp;

So, value has a 32bit float now, and I would like to print just the integer
part, like :
Read 26.92387 --> Print 26.
Simple, no float operations.

How I can do it ?

Thank!

-- 
Tanure
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161122/cfd32e55/attachment.html 


More information about the Kernelnewbies mailing list