IEEE-754 Float to int

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux