# Rounding half in ignition

**URL:** <https://forum.inductiveautomation.com/t/rounding-half-in-ignition/108291>\
**Category:** Ignition\
**Created:** [July 9, 2025, 8:22pm UTC](https://forum.inductiveautomation.com/t/rounding-half-in-ignition/108291 "2025-07-09T20:22:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![schen48](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@schen48](https://forum.inductiveautomation.com/u/schen48)\
**Post date:** [July 9, 2025, 8:22pm UTC](https://forum.inductiveautomation.com/t/rounding-half-in-ignition/108291/1 "2025-07-09T20:22:04Z")

</div>

How does the rounding in ignition work? it is not always rounding half to even or odd.  
round(0.0075,3) = 0.007  
round(0.0015,3) = 0.002  
any explanation?

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [July 9, 2025, 9:03pm UTC](https://forum.inductiveautomation.com/t/rounding-half-in-ignition/108291/2 "2025-07-09T21:03:48Z")

</div>

My guess is due to how numbers are stored in memory, that exactly 0.0075 and 0.0015 don't exist:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/9/79ffc00ad38b27187c98dd387476e0c23dc9dab3.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/0/407027d0445d767be69d300afee4d68a5f2d21f5.png)

So in memory, 0.0075 is actually 0.00749..... which rounds down and 0.0015 is rounding up either due to it being half and always rounding up or rounding to the nearest even (not sure how Jython handles this).

---

<div class="post-metadata">

**Author:** ![schen48](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@schen48](https://forum.inductiveautomation.com/u/schen48)\
**Post date:** [July 10, 2025, 1:33pm UTC](https://forum.inductiveautomation.com/t/rounding-half-in-ignition/108291/3 "2025-07-10T13:33:57Z")

</div>

That make sense.  
this is what I find about this, apparently it is a common thing in computer science:  
[15. Floating-Point Arithmetic: Issues and Limitations — Python 3.13.5 documentation](https://docs.python.org/3/tutorial/floatingpoint.html#tut-fp-issues)

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [July 10, 2025, 5:34pm UTC](https://forum.inductiveautomation.com/t/rounding-half-in-ignition/108291/4 "2025-07-10T17:34:27Z")

</div>

yep  
0.1 + 0.2 = 0.300000000000000004
