Quote:
Originally Posted by ed88
more than one instance of overloaded function "sqrt"
|
dwhitney67 gave you most of the answer. I'll add just a little more.
You can use an integer in place of a double anywhere the compiler
knows a double is required. For example, elsewhere in your program you have:
That 3 needs to be a double. You provided an int. The compiler understands all that and automatically casts the int to a double.
If the only available definition of sqrt(x) required x to be a double, then sqrt(3) would work just fine. The compiler would cast the int to a double.
But there is some other definition of sqrt available, maybe sqrt(std::complex<double>). I don't recall exactly what math.h brings in and also Visual Studio header files often bring in more than they are supposed to.
Int can be cast to the input type of more than one overload of sqrt, so the compiler doesn't know which sqrt() you mean.