I want to use math functions as pow and sqrt.

When i try to do that (including math.h) I get an error msg saying that these operator are double and i'm performing a calculation with integers :(

Any ideas?

Printable View

- 12-09-2001CockneyHow do I use mathematical operators?
I want to use math functions as pow and sqrt.

When i try to do that (including math.h) I get an error msg saying that these operator are double and i'm performing a calculation with integers :(

Any ideas? - 12-09-2001Prelude
You could try following the advice of the errors. Either declare the variables that you want to use the math functions on as double, or cast the result of the functions to int, like so:

Code:`int x = 256, result;`

result = (int)sqrt(x);

- 12-09-2001Cockney
Thx man :)

I used casting as

int x;

double approx_x;

approx_x=double(x);

Thanks :)