I have a script removing the remainder of a value. But due to a difference in the way JS rounds the decimal places the result is incorrect. I have since changed the script to use Math.floor() which returns the desired result but would still like an explanation as to why this is happening.
Is this issue the same as what is discussed in this thread: Rounding up or down when 0.5
The equation I am using is (138 / 54 ) - ( ( 138 % 54 ) / 54 )
When done in a calculator this returns 2 but through JS is returning 1.9999999999999998
When broken down (138 / 54 ) returns 2.5555555555555554
( ( 138 % 54 ) / 54 ) returns 0.5555555555555556