All of lore.kernel.org
 help / color / mirror / Atom feed
* IEEE-754 Float to int
@ 2016-11-22 16:05 Lucas Tanure
  2016-11-22 16:19 ` Anupam Kapoor
  2016-11-22 16:39 ` Greg KH
  0 siblings, 2 replies; 12+ messages in thread
From: Lucas Tanure @ 2016-11-22 16:05 UTC (permalink / raw)
  To: kernelnewbies

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 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-11-23 14:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAJX_Q+1iPpLnbLYB6=9gWR2EEwek5VvioBCZB6gYsChOZ3EyVA@mail.gmail.com>
2016-11-22 17:10 ` IEEE-754 Float to int Lucas Tanure
2016-11-22 20:33   ` Guenter Roeck
2016-11-22 16:05 Lucas Tanure
2016-11-22 16:19 ` Anupam Kapoor
2016-11-22 16:21   ` Lucas Tanure
2016-11-22 16:28     ` Anupam Kapoor
2016-11-22 16:30       ` Lucas Tanure
2016-11-22 16:39 ` Greg KH
2016-11-22 16:44   ` Lucas Tanure
2016-11-22 16:55     ` Greg KH
2016-11-23 12:30       ` Lucas Tanure
2016-11-23 14:04         ` Anupam Kapoor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.