Annotation of 43BSD/usr.lib/libF77/pow_di.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1980 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  *
        !             6:  *     @(#)pow_di.c    5.1     6/7/85
        !             7:  */
        !             8: 
        !             9: double pow_di(ap, bp)
        !            10: double *ap;
        !            11: long int *bp;
        !            12: {
        !            13: double pow, x;
        !            14: long int n;
        !            15: 
        !            16: pow = 1;
        !            17: x = *ap;
        !            18: n = *bp;
        !            19: 
        !            20: if(n != 0)
        !            21:        {
        !            22:        if(n < 0)
        !            23:                {
        !            24:                if(x == 0)
        !            25:                        {
        !            26:                        return(pow);
        !            27:                        }
        !            28:                n = -n;
        !            29:                x = 1/x;
        !            30:                }
        !            31:        for( ; ; )
        !            32:                {
        !            33:                if(n & 01)
        !            34:                        pow *= x;
        !            35:                if(n >>= 1)
        !            36:                        x *= x;
        !            37:                else
        !            38:                        break;
        !            39:                }
        !            40:        }
        !            41: return(pow);
        !            42: }

unix.superglobalmegacorp.com

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