# SQL query and decimals in float

**URL:** <https://forum.inductiveautomation.com/t/sql-query-and-decimals-in-float/79332>\
**Category:** Ignition\
**Created:** [September 19, 2023, 10:10am UTC](https://forum.inductiveautomation.com/t/sql-query-and-decimals-in-float/79332 "2023-09-19T10:10:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas227](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@Andreas227](https://forum.inductiveautomation.com/u/Andreas227)\
**Post date:** [September 19, 2023, 10:10am UTC](https://forum.inductiveautomation.com/t/sql-query-and-decimals-in-float/79332/1 "2023-09-19T10:10:03Z")

</div>

Hello Community,

I have a named query that returns a cycle time (float column in SQL)

When I run the query in the Ignition query browser, I get a value returned which is 15,2. That is fine.

However the Ignition table shows it with multiple decimals.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/3/63723fe32b299cbf0f33440230cd37cf0ca20384.png)

Screenshot above is from the selection value of the table. Opening the dataset on the table directly it is shown fine  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/1/71ac1ea28392f648df762815abe6262710d96ede.png)

This is an issue because I use this value later on numeric fields.  
I did build a way around it by rounding it and only displaying the last decimal, which works fine. However I wonder what the issue here is in Ignition adding the decimals that are not returned by the query ?

Btw. this is in Perspective

Thank you  
Andreas

---

<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:** [September 19, 2023, 11:52am UTC](https://forum.inductiveautomation.com/t/sql-query-and-decimals-in-float/79332/2 "2023-09-19T11:52:13Z")

</div>

But that **IS** what the query returned. This is normal behavior for floating point, because math. You always have to round at the point of display if the fractional part's least common denomination isn't a power of two (and within the number of bits available in the data type). 0.2 is ⅕, and the denominator is not a power of two, so its binary form is infinitely repeating.

---

<div class="post-metadata">

**Author:** ![Andreas227](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@Andreas227](https://forum.inductiveautomation.com/u/Andreas227)\
**Post date:** [September 19, 2023, 12:51pm UTC](https://forum.inductiveautomation.com/t/sql-query-and-decimals-in-float/79332/3 "2023-09-19T12:51:17Z")

</div>

That makes sense, Thank you then 🙂
