1: /*	@(#)floor.c	4.1	12/25/82	*/
   2: 
   3: /*
   4:  * floor and ceil-- greatest integer <= arg
   5:  * (resp least >=)
   6:  */
   7: 
   8: double  modf();
   9: 
  10: double
  11: floor(d)
  12: double d;
  13: {
  14:     double fract;
  15: 
  16:     if (d<0.0) {
  17:         d = -d;
  18:         fract = modf(d, &d);
  19:         if (fract != 0.0)
  20:             d += 1;
  21:         d = -d;
  22:     } else
  23:         modf(d, &d);
  24:     return(d);
  25: }
  26: 
  27: double
  28: ceil(d)
  29: double d;
  30: {
  31:     return(-floor(-d));
  32: }

Defined functions

floor defined in line 10; used 141 times
Last modified: 1985-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 420
Valid CSS Valid XHTML 1.0 Strict