|
|
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;
7: char *name;
8: {
9: if (errno)
10: perror(name);
11: else
12: printf
13: ("%10g %s\n", value, name);
14: errno = 0;
15: }
16:
17: main()
18: {
19: extern char *gets();
20: double x;
21: char string[64];
22:
23: for (;;) {
24: printf("Enter number: ");
25:
26: if (gets(string) == NULL)
27: break;
28: x = atof(string);
29:
30: display(x);
31: display(exp(x));
32: display(pow(10.0,x));
33: display(log(exp(x)));
34: display(log10(pow(10.0,x)));
35: }
36: putchar('\n');
37: }
38:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.