math.h is a standard C header.
When you use it, on Linux (and other Unix varients) you must also use the "-lm" switch when linking, as in
Code:
gcc -o example example.c -lm
This makes it include referenced functions from libm.a (or the equivilent).
If your compiler package does not supply math.h and the math library, I'm surprised.
However, you can write your own round() function:
Code:
double myround(double value, int places)
{
double adjust = 1.0;
long temp;
for (;places > 0; places--)
{
adjust *= 10;
}
temp = (long)((value * adjust) + 0.5);
return (double)temp / adjust;
}
Note that this function may not have exactly the same results as using round(), but it should give you good values. I've not tested this code -- I just typed it in here -- but I think that it's correct. I've not commented it, so see if you can figure out what it does and how it does it.