• Not Answered

Floating point 8192 Error

Hello All

We are using an adder to calculate our Motor running hours, whenever the motor running hours reach 8192, the adder stops to add.

Attaching the screenshot of Control Studio

Anyone else experienced similar issue while adding incremental values and knows the work around on that?

Thanks in advance

2 Replies

  • What you are seeing is the rounding error inherent to IEEE-754 floating point number storage (method of storing a floating point number as 32 bits of information).  As numbers get larger the resolution of the mantissa decreases.  The value of 8192.000485 and 8192 are both stored as 01000110000000000000000000000000 but 2.000485 is stored as 01000000000000000000011111110010.  As you can see in the table I've placed below, as the magnitude of the number increases, the accuracy decreases.

    As your base number (ADD1/IN2) grows larger you will see differing rounding errors due to the IEEE 754 conversion loosing resolution.  

    If you want to see the actual results and errors for different values I've found this site useful:  https://www.h-schmidt.net/FloatConverter/IEEE754.html

    Float IEEE 754 representation Error
    8192.0 01000110000000000000000000000000 0
    8192.000485 01000110000000000000000000000000 -0.000485
    2.000485 01000000000000000000011111110010 -5.6610107421875E-8
    102.000485 01000010110011000000000001000000 0.00000328125
    2052.000485 01000101000000000100000000000010 0.00000328125
    4092.000485 01000101011111111100000000000010 0.00000328125
    8190.000485 01000101111111111111000000000001 0.00000328125
  • In reply to Scott Thompson:

    Excellent explanation