# Need to merge two INT values in order to make it float(real)

**URL:** <https://forum.inductiveautomation.com/t/need-to-merge-two-int-values-in-order-to-make-it-float-real/106452>\
**Category:** General Discussion\
**Tags:** ignition81\
**Created:** [May 20, 2025, 12:26pm UTC](https://forum.inductiveautomation.com/t/need-to-merge-two-int-values-in-order-to-make-it-float-real/106452 "2025-05-20T12:26:51Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 20, 2025, 12:42pm UTC](https://forum.inductiveautomation.com/t/need-to-merge-two-int-values-in-order-to-make-it-float-real/106452/3 "2025-05-20T12:42:07Z")

</div>

Combine your INTs to 32 bits using shift and bitwise OR, then run the result through Java's [Float.intBitsToFloat()](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Float.html#intBitsToFloat(int)) static method. Some inspiration:

> [@Convert decimal to float](https://forum.inductiveautomation.com/t/convert-decimal-to-float/80901/10):
>
> You could probably handle that by making SIM\_AI an expression tag, using the other 2 in its expression. In the script library: from java.lang import Float def convert\_to\_float(int\_val): return Float.intBitsToFloat(int\_val) expression: runScript( 'test.convert\_to\_float', 0, {[.]sources/source}[0] \<\< 16 | {[.]sources/source}[1] ) [image] I think it's cleaner/easier to follow, as it makes SIM\_AI responsible for computing its value, and I'm willing to bet it's also faster. edit: Wait, it …

---

_[View the full topic](https://forum.inductiveautomation.com/t/need-to-merge-two-int-values-in-order-to-make-it-float-real/106452)._
