/* int _MulUnsArrByPwrOf10(pa,n,w) * * ARGUMENT * unsigned pa[]; * int n; power of 10 to multiply by * int w; number of digits * * DESCRIPTION * Multiplies the pa[] array by 10^n (0 #include #include "gm.h" #include "gmsystem.h" extern double pow(double, double); int Multiply(sr,num,m) unsigned SHORT sr[],num; int m; { int i; unsigned long pdst[10],maxunsint; unsigned SHORT carry; #ifdef SH_LIB maxunsint=1; for (i=1;i<=BITSPERUI;i++) maxunsint*=2; maxunsint--; #else maxunsint=(unsigned long)pow(2.,(float)BITSPERUI)-1; #endif carry=0; for (i=0;imaxunsint) { carry=(unsigned SHORT)(pdst[i]>>BITSPERUI); sr[i]=(unsigned SHORT)(pdst[i]&maxunsint); } else { carry=0; sr[i]=(unsigned SHORT)pdst[i]; } } return( (carry)? GM_OVERFLOW : GM_SUCCESS ); } int _MulUnsArrByPwrOf10(pa,n,w) unsigned SHORT pa[]; int n,w; { int ppdf,k,i; k=GM_SUCCESS; if (n>47) { k=GM_OVERFLOW; } while ((n>4)&&(k==GM_SUCCESS)) { k=Multiply(pa,10000,w); n-=4; } if (k!=GM_OVERFLOW) { #ifdef SH_LIB ppdf=1; for (i=1;i<=n;i++) ppdf*=10; #else ppdf=(int)pow(10.,(double)n); #endif k=Multiply(pa,ppdf,w); } return(k); }