FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
03-22-2024 11:47 AM
Hello,
when I try to show 64bit integer PLC values like “LINT” (correlates "Int64" for OPC UA) or “ULINT” and “LWORD” (correlates "UInt64" for OPC UA), the value is not shown correctly.
The last 4 digits seems to be rounded when I try to use values near the type defined maximum for these data types.
The LINT PLC value “-9223372036854775808” is shown as “-9223372036854776000”.
The ULINT and LWORD PLC value “18446744073709551615” is shown as “18446744073709552000”.
When I enter the value "-9223372036854775808" into the input field for the LINT value, the correct value "-9223372036854775808" is written into the PLC, but the HMI shows “-9223372036854776000".
32bit and 16bit Integer values are shown correct, even I reach the maximum value for these data types.
Solved! Go to Solution.
03-22-2024 02:25 PM
JavaScript has its own limits which affect all web HMI systems:
Number.MAX_SAFE_INTEGER is 9007199254740991
"The term "safe" refers to the fact that any number greater than the one mentioned above cannot be assumed to be accurately and appropriately represented. This restriction is imposed by the doubleprecision 64-bit number format used by Javascript"
https://www.tutorialspoint.com/what-is-javascript-s-highest-integer-value-that-a-number-can-go-to-wi...
Please also see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INT...https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.max_safe_integer