But when i try to calculate the whole thing for var "x" in its declaration, it prints 2. longdouble x=400*400/400;
gives
2
Actually it prints "2" for any calculation whose result will contain more than 6 digits (i guess). Can anyone tell me why? I really don't seem to get it given I've been using long double..it's range is supposed to be more than just 6 digits, right?
Have you tried just printing out the result of the calculation to see what is it? That would have been a quicker way to find out what was going on than writing a question here and waiting to see if someone answers.