/****************************************************************************** * * * COMPUTE MERTENS FUNCTION (Deleglise & Rivat's algorithm) * * 10/16/15 (dkc) * * * ******************************************************************************/ #include <math.h> void div64_32(unsigned int *dividend, unsigned int *quotient, unsigned int divisor); double nuloc(unsigned int x1, unsigned int x2, unsigned int u, char *mob, int *M) { unsigned int i,j,k,m,X[2],Q[2],R[2],index; double temp,temp1,sumb; X[0]=x1; X[1]=x2; sumb=0.0; for (m=1; m<=u; m++) { temp=(double)mob[m-1]; j=u/m+1; // k=(unsigned int)sqrt((double)(x/m)); div64_32(X,Q,m); temp1=(double)Q[0]*65536.0*65536.0; temp1=temp1+(double)Q[1]; temp1=temp1/10000.0; k=(unsigned int)(sqrt(temp1)*100.0); for (i=j; i<=k; i++) { // sumb=sumb+temp*(double)M[x/(m*i)-1]; div64_32(X,R,m*i); index=R[1]; sumb=sumb+temp*(double)M[index-1]; } } return(sumb); }