Issue
Numbers are rounded.
Why two values of nearly equal magnitude are subtracted, significant digits are lost.
This occurs in a variety of places within EcoStruxure Buildings Operation, and explained using a script program in the example below.
Product Line
Ecostruxure Building Operation
Environment
- Building Operation Enterprise Server
- Building Operation Automation Server
Cause
In a string program and the NumToStr function, if a number (example 5.7) is entered and Save is selected, then the Value in the Variables window at the bottom shows 5.6999998. The value is altered from the original.
Resolution
When looking at a value in the watch window or variables view, there is no rounding so you are going to see the full length of the float number which suffers from a thing called “loss of significance”
More information on float numbers can be found at: https://en.wikipedia.org/wiki/Loss_of_significance This phenomenon happens everywhere.
An alternative would be to add a formatting feature to do the rounding.
Script handles numbers as IEEE754 single precision floats, so the accuracy is limited to (IIRC) seven significant digits.
The accuracy loss starts around 1.677E7.
On www.binaryconvert.com/convert_float.html?decimal site, a decimal number can be converted to binary and then back to decimal in order to see how the decimal number will be handled in Script.