# Real Values from PLC Not Reading Correctly

**URL:** <https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706>\
**Category:** Ignition\
**Created:** [December 11, 2024, 7:31pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706 "2024-12-11T19:31:51Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [December 11, 2024, 7:31pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/1 "2024-12-11T19:31:51Z")

</div>

Hey Ignition Community,

Got a weird issue. When reading REALs from AB PLC, I have loads of extra numerals coming along with it. here's some screenshots. I have no issues with memory tags, only OPC.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/6/b6a7d586512a74550428c829ffc46f34cc135011.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/f/af743cf09bdd7c6eadd1c0c26762c31ec1c17315.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/f/5ffb27724a69620193c700e927c4e58b576d746d.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 11, 2024, 7:34pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/2 "2024-12-11T19:34:00Z")

</div>

It's not extra, see [IEEE-754 Floating Point Converter](https://www.h-schmidt.net/FloatConverter/IEEE754.html) and plug in `20.1`.

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [December 11, 2024, 7:46pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/3 "2024-12-11T19:46:32Z")

</div>

makes sense. Any small scripts we can run to format the value?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [December 11, 2024, 7:52pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/4 "2024-12-11T19:52:14Z")

</div>

Use the `FormatString` property on the tag.

If displaying in a regular label, use [`numberFormat()`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/string/numberFormat) in an expression and point it at that property on the tag.

For numeric labels, bind the label's `numberFormatPattern` to that tag property.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 11, 2024, 7:52pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/5 "2024-12-11T19:52:29Z")

</div>

If this is actually an issue for you outside the tag browser you should use a number/format string at the point of display.

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [December 11, 2024, 7:58pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/6 "2024-12-11T19:58:17Z")

</div>

I'm not displaying the value. Its a sequence number that I'm trying to use as a key for a DB query in a transaction group.

so on value changed I run the stored procedure and get all info for seq 20.1. However, the stored procedure is not running because my 20.1 is actually 20.100000381.

Trying yo format in the Value changes script, but im getting a "TypeError: 'float' object is not callable" now

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 11, 2024, 8:01pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/7 "2024-12-11T20:01:19Z")

</div>

> [@Jason\_Platt](#):
>
> Its a sequence number that I'm trying to use as a key for a DB query in a transaction group.

Using a real/float for that is kind of insane...

You can make an expression tag that uses the `numberFormat` expression to and then reference the expression tag.

> **[numberFormat | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/string/numberFormat)**
>
> Returns a string version of the number argument, formatted as specified by the pattern string.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 11, 2024, 8:06pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/8 "2024-12-11T20:06:10Z")

</div>

If it's a sequence number, then it really should be a string, even if it contains only digits.

Assuming the two things are incrementing counts, what are you going to do if you get to run 10 of sequence 20? `20.10` is exactly numerically equivalent to `20.1`.

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [December 11, 2024, 8:06pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/9 "2024-12-11T20:06:23Z")

</div>

blame AB for not giving me better data types.

not sure how to do sequence numbers without decimals

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 11, 2024, 8:11pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/10 "2024-12-11T20:11:16Z")

</div>

Maybe what you're calling a sequence number is different than what I think a sequence number is... never seen a "sequence number" be a decimal type. It's always a sequentially incrementing integer type.

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [December 11, 2024, 8:16pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/11 "2024-12-11T20:16:29Z")

</div>

great question. I inherited this project. We currently dont have a seq that goes past xx.9

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [December 11, 2024, 8:19pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/12 "2024-12-11T20:19:29Z")

</div>

so its currently 10.0, 10.1, 10.2, then 11.0 so on and so forth.

it depends on what's being build. the whole number is for a specific part that's going on the product, the decimal places are individual actions for the one part.

I very well may just make these all INTs and start at 100. Minor takes would be 101 or something.

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [December 11, 2024, 8:30pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/13 "2024-12-11T20:30:07Z")

</div>

in the mean time, I made the data type on the Ignition tag a string. Seems to be working. Going forward, im going to scrap this idea these guys had about using reals for sequence, back to ints.

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [December 11, 2024, 8:48pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/14 "2024-12-11T20:48:26Z")

</div>

I am actually intrigued, do they check the currently running sequence value with `LIMIT` blocks? Surely the `EQU` and `NEQ` would cause issues if you specified static comparisons with a direct decimal value: 20.1 != 20.100000381

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [December 12, 2024, 7:00pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/15 "2024-12-12T19:00:32Z")

</div>

not sure how AB does it, but all that is filtered out. Just shows as 20.1 in the PLC.

---

<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:** [December 12, 2024, 8:06pm UTC](https://forum.inductiveautomation.com/t/real-values-from-plc-not-reading-correctly/99706/16 "2024-12-12T20:06:12Z")

</div>

> [@Jason\_Platt](#):
>
> how AB does it

AB just rounds to 6 or 7 significant digits for 32-bit REAL. That hides trailing non-significant digits. For 64-bit LREAL (double in java), there can be ~16 significant digits, so rounding to to 6 or 7 actually throws away possibly valid decimal places.

AB isn't magically eliminating the fundamental inaccuracy of floating point fractions that have any denominator other than powers of two.
