#include #include #include #include #define PI 3.1415926535 int isnan(double); int main(int argc, char *argv[]) { char *c; double x; double y; printf("ceil(7.28) = %f\n", ceil(7.28)); printf("floor(7.28) = %f\n", floor(7.28)); printf("fabs(3.14) = %f\n", fabs(3.14)); printf("fabs(-3.14) = %f\n", fabs(-3.14)); printf("log10(34) = %f\n", x = log10(34)); printf("and back .. pow(10, %f) = %f\n", x, pow(10, x)); printf("log(34) = %f\n", x = log(34)); printf("and back .. exp(%f) = %f\n", x, exp(x)); printf("fmod(8.2, 4.1) = %f\n", fmod(8.2, 4.1)); printf("fmod(8.2, 4) = %f\n", fmod(8.2, 4)); printf("modf breaks the integer and fraction up\n"); x = modf(8.2, &y); printf("modf(8.2, &y) = %f, and y = %f\n", x, y); printf("sqrt(123) = %f\n", sqrt(123)); printf("sin(pi/6) = %f\n", x = sin(PI/6)); printf("asin(%f) = %f; 6 times it is %f\n", x, asin(x), 6 * asin(x)); printf("cos(pi/6) = %f\n", x = cos(PI/6)); printf("acos(%f) = %f; 6 times it is %f\n", x, acos(x), 6 * acos(x)); printf("tan(pi/6) = %f\n", x = tan(PI/6)); printf("atan(%f) = %f; 6 times it is %f\n", x, atan(x), 6 * atan(x)); x = sqrt(-1.0); printf("sqrt(-1) = %f\n", x); if (isnan(x)){ perror("sqrt"); } c = strerror(errno); printf("The error message is \"%s\"\n", c); return(0); }