spoj-area difference(SQDIFF)-confusion between float & double

The link to my program is http://ideone.com/AwTzyO.
Whwn I use ‘double’ instead of ‘float’ on spoj my solution is accepted but when I use datatype of ‘float’ for ans ;spoj shows wrong answer…Please tell me why is it happening so?

Check this link

double is bigger and better than float

The link to accepted solution is http://ideone.com/G96ePR

Thanks a lot for the answer…but still I have one confusion…using float is not much appropriate(but using float is not compleely wrong) Then why spoj shows wrong answer for it?