Annotation of cci/usr/src/usr.lib/libF77/zabs.c, revision 1.1

1.1     ! root        1: /*
        !             2:  *     "@(#)zabs.c     1.1"
        !             3:  */
        !             4: 
        !             5: /* THIS IS BASED ON TAHOE FP REPRESENTATION */
        !             6: #include <FP.h>
        !             7: 
        !             8: double zabs(real, imag)
        !             9: double real, imag;
        !            10: {
        !            11: double temp, sqrt();
        !            12: 
        !            13: if(real < 0)
        !            14:        *(long int *)&real ^= SIGN_BIT;
        !            15: if(imag < 0)
        !            16:        *(long int *)&imag ^= SIGN_BIT;
        !            17: if(imag > real){
        !            18:        temp = real;
        !            19:        real = imag;
        !            20:        imag = temp;
        !            21: }
        !            22: if(imag == 0.)         /* if((real+imag) == real) */
        !            23:        return(real);
        !            24: 
        !            25: temp = imag/real;
        !            26: temp = real*sqrt(1.0 + temp*temp);  /*overflow!!*/
        !            27: return(temp);
        !            28: }

unix.superglobalmegacorp.com

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