|
|
1.1 root 1: #include <math.h>
2: #include <stdio.h>
3: #define display(x) dodisplay((double)(x), #x)
4:
5: dodisplay(value, name)
6: double value; char *name;
7: {
8: if (errno)
9: perror(name);
10: else
11: printf("%10g %s\n", value, name);
12: errno = 0;
13: }
14:
15: main()
16: {
17: extern char *gets();
18: double x;
19: char string[64];
20:
21: for (;;) {
22: printf("Enter number: ");
23: if (gets(string) == NULL)
24: break;
25:
26: x = atof(string);
27: display(x);
28: display(cos(x));
29: display(sin(x));
30: display(tan(x));
31: display(acos(cos(x)));
32: display(asin(sin(x)));
33: display(atan(tan(x)));
34: display(atan2(sin(x),cos(x)));
35: display(hypot(sin(x),cos(x)));
36: display(cabs(sin(x),cos(x)));
37: }
38: }
39:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.