# can anyone please explain how 2.8 modulo 2 is 0.7999999999999998? [duplicate]

I am not a mathematician, and just started programming in javascript and wonders how 2.8 % 2 = 0.7999999999999998.
Note: I know it is remainder operation.
May be I forgot my school mathematics concepts. Can anyone please explain this? Thanks.

• What do you mean with modulo? Mar 24, 2016 at 12:37
• That is just a glitch caused by the floating point system. Mar 24, 2016 at 12:39
• Are you wondering why it isn't $0.8$ like it should be or are you confused about the modulo operation? Mar 24, 2016 at 12:39
• Are you asking why computers do not represent floating point numbers exactly, or why $2.8 = 0.8\bmod 2$? Mar 24, 2016 at 12:40
• modulo is remainder operator. here in my question if we divide 2.8 by 2, then we are getting remainder 0.7999999999999998. do you know how? or i think it is programming related doubt. i expect the answer should be 0.8. Mar 24, 2016 at 12:41

The floating point number 2.8 cannot be exactly represented in your Javascript floating point number: the binary64 IEEE double precision number is $$2.8 \rightarrow 2.79999999999999982236431605997495353221893310546875\dots$$