Numeric Text Field - Float vs Double Issue

Overview:

  • I have an Ignition project (Vision) with a single connection to a Modbus TCP compatible device (flow computer).
  • I am using Numeric Text Field to update values in said device. Number Type is configured as "Double".
  • My OPC tag is configured as "Double" precision tag, mapped to the following Modbus register ([testDevice]1.HRD31288.

Problem:

  • Say I want to enter a value of "13.3".
  • If I enter the value of "13.3" in the numeric text box and press enter, the value sent to the device ends up being "13.300000190734863000".
  • If I enter the value of "13.3" in the Visual Property Editor, in the "Value (Double)" field, the value sent to the end device ends up being "13.3" (with a lot of zeroes).

It seems like the Numeric Text Field convers my Double to Single floating point number prior to being sent to the device.

If I change the parameter in the end device instead, it is read correctly into Ignition (i.e. as round "13.3").

Is there something I am missing, or is the numeric entry box always doing a conversion to single precision float?

This is totally normal and unavoidable with binary numbers in floating point. 3/10 doesn't have an exact binary fraction (least common denominator includes 5). User interfaces typically hide this technicality from operators using some amount of rounding. (At the point of display.)

I do understand why some numbers cannot be represented accurately in memory.

However, what I am saying is that when a number is entered via Numeric Text Field, it appears to be converted to 32-bit float, despite the fact that binding, tags and Modbus link are all configured as 64-bit doubles.

Any ideas how to avoid it?

Hmmm. Looking closer, I think you are right. The numeric field looks like it is coercing to single precision somewhere. Or perhaps the driver is doing it. Consider testing with my alternate driver.

You should report this as a possible bug. (Open a support ticket.)

I will do, I was just hoping that I have made a stupid mistake somewhere, as I tend to blame myself first.

This is a known/accepted issue in Vision's numeric text field component; if you want to talk to support you can reference our internal ticket number IGN-11528.
We're delegating the internal string -> number type to an external library, and that external library goes from smallest -> largest possible presentation, and 13.3 happens to be a value that can be (acceptably to the library, at least) represented in a 32-bit float, and therefore that's what is returned.

Changing that logic in the numeric text field risks regressions in the other direction - there is no winning. We talked about the idea of introducing a "precision" editor component that worked the other way, but deferred it due to relative lack of demand.

What you could do today would be to use a formatted text field, with a regex to only allow numeric inputs, and 'bind' the writes back to a tag yourself.

OK, this is proving to be quite problematic, I was not expecting the core numeric entry component not to be compatible with double precision numbers.

I will try to use the formatted text field and see if it works.