Wrong answer for IALG1

Could anyone explain whats wrong with my solution for problem IALG1? I have tested for a lot of test cases and my solution appears to be similar to the accepted ones.
Link to problem: CodeChef: Practical coding for everyone
Link to my solution: CodeChef: Practical coding for everyone

check your answer for the case 0.999999…999 this should give 1

here is my code submission