4 Replies Latest reply on Mar 7, 2017 11:23 PM by sana mujawar

    Error in comparing decimal numbers

    sana mujawar

      Hi All,


      I am facing a unique issue of not being able to compare the 2 decimal nos. for a specific scenario.


      I am trying to compare current month and previous month values for all the cities.

      comparision error.png


      In the above image, 1st column is "CURRENT MONTH"  and 2nd coulmn is  "PREVIOUS MONTH".

      The yellow arrow shows that both values are "EQUAL" and green show that the "CURRENT MONTH VALUE > PREVIOUS MONTH VALUE".


      But as you can see, "Salem" has same values for both the months, yet not compared correctly.

      Whereas for "Madurai", even after having decimal values, they are being compared correctly.


      In Excel datasource, the value for Madurai for both months is 14.1666667 while for Salem is 13.3333333.

      I tried changing values in excel and found the that

                1. When both values of Salem are changed  to 13.265 then the comparision shows "EQUAL(i.e. Yellow arrow)".

                2.When both are changed to 13.3333335, comparision goes wrong .(both show 13.3 yet  Green arrow)


      The calculation is


      where "current capacity" is value for CURRENT MONTH and "previous capacity is value for "PREVIOUS MONTH".


      Please assist.


      Thanks ,