Originally Posted by

**time4f5**
I guess I am wrong. thanks for the heads up. I always assumed that I had to include certain libraries math.h if I wanted to do math functions and not give all of the instructions.

<math.h> declares a number of mathematical functions (for example, pow(), exp(), etc). If you are not using those functions (or other things declared in <math.h>) then you do not need to #include that header.

Basic mathematical operations (for example, multiplication, division, etc) on floating point variables do not require inclusion of <math.h>. So the following is quite valid.

Code:

#include <stdio.h> /* as we are using printf() */
/* Note we do not include <math.h> */
int main()
{
int i;
double x = 1.0;
for (i = 0; i < 4; ++i)
{
x *= 2.0; /* a basic floating point operation */
printf("%f ", x);
}
printf("\n");
return 0;
}

Linking that program may be another story (as it may be necessary to link in floating point support, in order to print out floating point values) but the source code is valid.