# Convert Hex to IEEE-754 float

**URL:** <https://discuss.elastic.co/t/convert-hex-to-ieee-754-float/89863>\
**Category:** Logstash\
**Created:** [June 18, 2017, 10:53pm UTC](https://discuss.elastic.co/t/convert-hex-to-ieee-754-float/89863 "2017-06-18T22:53:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xavier\_Clavien](https://avatars.discourse-cdn.com/v4/letter/x/57b2e6/32.png) [@Xavier\_Clavien](https://discuss.elastic.co/u/Xavier_Clavien)\
**Post date:** [June 18, 2017, 10:53pm UTC](https://discuss.elastic.co/t/convert-hex-to-ieee-754-float/89863/1 "2017-06-18T22:53:54Z")

</div>

Hello  
I need to convert a Hex value in floatting point 32bits can I use ruby for that? if yes, how?  
Any other suggestions?  
Thanks for your help

---

<div class="post-metadata">

**Author:** ![Xavier\_Clavien](https://avatars.discourse-cdn.com/v4/letter/x/57b2e6/32.png) [@Xavier\_Clavien](https://discuss.elastic.co/u/Xavier_Clavien)\
**Post date:** [June 20, 2017, 10:09pm UTC](https://discuss.elastic.co/t/convert-hex-to-ieee-754-float/89863/2 "2017-06-20T22:09:46Z")

</div>

For those who are looking how to do that here is the way working for me :

> event.set( '[ln\_resistance]', [event.get('[ln\_resistance\_B\_inversion]')].pack('H\*').unpack('g').first )

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 18, 2017, 10:09pm UTC](https://discuss.elastic.co/t/convert-hex-to-ieee-754-float/89863/3 "2017-07-18T22:09:54Z")

</div>

Closed on July 18, 2017, 10:09pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
