Rounding off a number is called Loss of Significance

Issue

Numbers are rounded
or
Why two values of nearly equal magnitude are subtracted, significant digits are lost. 

This occurs in a variety of places within StruxureWare Buildings Operation, and explained using a script program in the example below.

Product Line

SmartStruxure Solution

Environment

StruxureWare Building Operation Site, all releases

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 number can be found at: http://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 you can convert a decimal number to binary and then back to decimal in order to see how the decimal number will be handled in Script.

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 this site you can convert a decimal number to binary and then back to decimal in order to see how the decimal number will be handled in Script. http://www.binaryconvert.com/convert_float.html?decimal