SQL query and decimals in float

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

Screenshot above is from the selection value of the table. Opening the dataset on the table directly it is shown fine
image

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

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.

2 Likes

That makes sense, Thank you then :slight_smile: