1: /*
2: * floor - calculate largest integer not greater than d.
3: */
4: double modf();
5: double
6: floor(d)
7: double d;
8: {
9: double fract;
10:
11: if (d<0.0) {
12: d = -d;
13: fract = modf(d, &d);
14: if (fract != 0.0)
15: d += 1;
16: d = -d;
17: } else
18: modf(d, &d);
19: return(d);
20: }
21:
22: /*
23: * ceil - calculate smallest integer not less than d.
24: */
25: double
26: ceil(d)
27: double d;
28: {
29: return(-floor(-d));
30: }
Defined functions
ceil
defined in line
25;
never used
floor
defined in line
5; used 2 times