10 years, 3 months ago.

Using sine function

I am trying to get the sine of a value using this:

XH = X*cos(pitch);

X and XH are floats and pitch is an integer.

When I run this I get error code 308 but i am unsure on what this means. How do I get the sine of a value?

1 Answer

10 years, 3 months ago.

"Error: More than one instance of overloaded function "cos" matches the argument list"

This means that there are two or more functions that the compiler found called "cos" that match the type of the parameter you passed.

I'm not sure of the details of why there is more than one, but one way around it would be to cast the argument to another numeric type

XH = X*cos((double)pitch);

That should work.