Hi Vishal,
This is not a bug just a fact of programming life. When dealing with IEEE floating point values you must realize that it is not integer arithmetic. Values usually calculated will vary about some epsilon value. Good starting point float: 1e-6, and double: 1e-12.
Your example also shows the problems with just truncating floating point values into integers and expecting some actual result.
In my opinion, when dealing with floating point numbers
you should always use a round function or just make sure the value is between value + or - epsilon.
Regards,
Manfred.