Different outputs why?

If the change the datatype of i from float to double
why is 0.9 getting printed?

https://ide.geeksforgeeks.org/a8ejoNPEd0

https://ide.geeksforgeeks.org/YAVYHjlVFJ

Hello @deepak_four even i have encountered this condition for the first time.
and i have read the documentation and it is recommended there not to use double and the float in the for loop because it will given differernt results everytime.
i think this might be the reason.
it can be the property of the double.
Happy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.