whst is the meaning of output -nan?
Try avoiding squaring huge terms (like some values may be 10^18 and if u square it then it becomes 10^36 and it may get u -nan)
Cuz u must have done sqrt of that number… and sqrt of negative number is not possible…
-nan means NotANumber(because if a number exceeds max limit then it will become negative)
Try using long double… Avoid calculations where u need to square values which are high enough and check if a value is not negative before before doing sqrt…check if there is any alternate for squaring a huge number
PS: this is soln to avoid -nan according to what I have experienced…
The word NaN stands for Not a number…
It usually occur whenevr we have used the value which is undefined.
For eg. The square root of a negative number is undefined and hence it will give the NaN as output
Similarly if you take the log of the negative number it will give you NaN as output.
Hope it will help.