|
|
1.1 ! root 1: /* ! 2: * floor and ceil-- greatest integer <= arg ! 3: * (resp least >=) ! 4: */ ! 5: ! 6: double modf(); ! 7: ! 8: double ! 9: floor(d) ! 10: double d; ! 11: { ! 12: double fract; ! 13: ! 14: if (d<0.0) { ! 15: d = -d; ! 16: fract = modf(d, &d); ! 17: if (fract != 0.0) ! 18: d += 1; ! 19: d = -d; ! 20: } else ! 21: modf(d, &d); ! 22: return(d); ! 23: } ! 24: ! 25: double ! 26: ceil(d) ! 27: double d; ! 28: { ! 29: return(-floor(-d)); ! 30: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.