Annotation of 43BSD/contrib/icon/rt/floor.c, revision 1.1

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

unix.superglobalmegacorp.com

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