Annotation of researchv10no/libj/norm.c, revision 1.1.1.1

1.1       root        1: norm(x,y,z)
                      2: {
                      3:        return (sqrt(x*x + y*y + z*z));
                      4: }
                      5: 
                      6: sqrtryz(x,y,z)
                      7: {
                      8:        register long sumsq;
                      9: 
                     10:        sumsq = x*x - y*y - z*z;
                     11:        if (sumsq <= 0)
                     12:                return 0;
                     13:        return ( sqrt(sumsq) );
                     14: }
                     15: 
                     16: #define MAXROOT 0xb504
                     17: sqrt(x)
                     18:        register long x;
                     19: {
                     20:        register long high=MAXROOT;
                     21:        register long low=0;
                     22:        register long current=MAXROOT/2;
                     23:        if(x<=0)
                     24:                return 0;
                     25:        if(x>=MAXROOT*MAXROOT)
                     26:                return(MAXROOT);
                     27:        while(high>low+1){
                     28:                if(current*current==x)
                     29:                        return (current);
                     30:                if(current*current>x)
                     31:                        high=current;
                     32:                else
                     33:                        low=current;
                     34:                current=(high+low)>>1;
                     35:        }
                     36:        return(current);
                     37: }

unix.superglobalmegacorp.com

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