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

The link to my program is AwTzyO - Online C Compiler & Debugging Tool - Ideone.com.
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 G96ePR - Online C Compiler & Debugging Tool - Ideone.com

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?