Annotation of 42BSD/usr.lib/libm/floor.c, revision 1.1.1.1

1.1       root        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: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.