|
|
1.1 root 1:
2:
3: ceil() Mathematics Function ceil()
4:
5:
6:
7:
8: Set numeric ceiling
9:
10: #include <math.h>
11: ddoouubbllee cceeiill(_z) ddoouubbllee _z;
12:
13: ceil returns a double-precision floating point number whose value
14: is the smallest integer greater than or equal to z.
15:
16: ***** Example *****
17:
18: The following example demonstrates how to use ceil:
19:
20:
21: #include <math.h>
22: #include <stdio.h>
23: #define display(x) dodisplay((double)(x), #x)
24:
25:
26:
27: dodisplay(value, name)
28: double value; char *name;
29: {
30: if (errno)
31: perror(name);
32: else
33: printf("%10g %s\n", value, name);
34: errno = 0;
35: }
36:
37:
38:
39: main()
40: {
41: extern char *gets();
42: double x;
43: char string[64];
44:
45:
46:
47: for (;;) {
48: printf("Enter number: ");
49: if (gets(string) == NULL)
50: break;
51: x = atof(string);
52:
53:
54:
55: display(x);
56: display(ceil(x));
57: display(floor(x));
58: display(fabs(x));
59: display(sqrt(x));
60: }
61: putchar('\n');
62:
63:
64: COHERENT Lexicon Page 1
65:
66:
67:
68:
69: ceil() Mathematics Function ceil()
70:
71:
72:
73: }
74:
75:
76: ***** See Also *****
77:
78: abs(), fabs(), floor(), frexp(), mathematics library
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130: COHERENT Lexicon Page 2
131:
132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.