The C Programming Language by Ritchie says that:
The library routine
sqrtexpects a double type and will produce nonsense if inadvertently handled something else. So if
nis an integer, we can use
sqrt((double) n)to convert the value of
But the following code works fine on my system:
Then also it is giving the same result as
sqrt((double)9). Why is my compiler not following the book?