diff --git a/src/plugins/weatherdata/gfs/g2clib/compack.c b/src/plugins/weatherdata/gfs/g2clib/compack.c index 358b427b0..2adb9ac53 100644 --- a/src/plugins/weatherdata/gfs/g2clib/compack.c +++ b/src/plugins/weatherdata/gfs/g2clib/compack.c @@ -77,12 +77,12 @@ void compack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl, g2int missopt, miss1, miss2, ier; g2float bscale,dscale,rmax,rmin,temp; static g2int simple_alg = 0; - static g2float alog2=0.69314718; // ln(2.0) + static g2float alog2=0.69314718f; // ln(2.0) static g2int one=1; ival1 = 0; - bscale=int_power(2.0,-idrstmpl[1]); - dscale=int_power(10.0,idrstmpl[2]); + bscale=(g2float)int_power(2.0,-idrstmpl[1]); + dscale=(g2float)int_power(10.0,idrstmpl[2]); // // Find max and min values in the data // @@ -151,7 +151,7 @@ void compack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl, // find num of bits need to store minsd and add 1 extra bit // to indicate sign // - temp=log((double)(abs(minsd)+1))/alog2; + temp=(g2float)log((double)(abs(minsd)+1))/alog2; nbitsd=(g2int)ceil(temp)+1; // // find num of bits need to store ifld[0] ( and ifld[1] @@ -159,7 +159,7 @@ void compack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl, // maxorig=ival1; if (idrstmpl[16]==2 && ival2>ival1) maxorig=ival2; - temp=log((double)(maxorig+1))/alog2; + temp=(g2float)log((double)(maxorig+1))/alog2; nbitorig=(g2int)ceil(temp)+1; if (nbitorig > nbitsd) nbitsd=nbitorig; // increase number of bits to even multiple of 8 ( octet ) @@ -261,7 +261,7 @@ void compack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl, } // calc num of bits needed to hold data if ( gref[ng] != imax ) { - temp=log((double)(imax-gref[ng]+1))/alog2; + temp=(g2float)log((double)(imax-gref[ng]+1))/alog2; gwidth[ng]=(g2int)ceil(temp); } else @@ -283,7 +283,7 @@ void compack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl, igmax=gref[0]; for (j=1;j igmax) igmax=gref[j]; if (igmax != 0) { - temp=log((double)(igmax+1))/alog2; + temp=(g2float)log((double)(igmax+1))/alog2; nbitsgref=(g2int)ceil(temp); sbits(cpack,gref,iofst,nbitsgref,0,ngroups); itemp=nbitsgref*ngroups; @@ -309,7 +309,7 @@ void compack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl, if (gwidth[j] < ngwidthref) ngwidthref=gwidth[j]; } if (iwmax != ngwidthref) { - temp=log((double)(iwmax-ngwidthref+1))/alog2; + temp=(g2float)log((double)(iwmax-ngwidthref+1))/alog2; nbitsgwidth=(g2int)ceil(temp); for (i=0;iival1) maxorig=ival2; - temp=log((double)(maxorig+1))/alog2; + temp=(g2float)log((double)(maxorig+1))/alog2; nbitorig=(g2int)ceil(temp)+1; if (nbitorig > nbitsd) nbitsd=nbitorig; // increase number of bits to even multiple of 8 ( octet ) @@ -353,7 +353,7 @@ void misspack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl, if (missopt == 2) imax=imax+2; // calc num of bits needed to hold data if ( gref[ng] != imax ) { - temp=log((double)(imax-gref[ng]+1))/alog2; + temp=(g2float)log((double)(imax-gref[ng]+1))/alog2; gwidth[ng]=(g2int)ceil(temp); } else { @@ -388,7 +388,7 @@ void misspack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl, if (missopt == 1) igmax=igmax+1; if (missopt == 2) igmax=igmax+2; if (igmax != 0) { - temp=log((double)(igmax+1))/alog2; + temp=(g2float)log((double)(igmax+1))/alog2; nbitsgref=(g2int)ceil(temp); // reset the ref values of any "missing only" groups. mtemp=(g2int)int_power(2.,nbitsgref); @@ -422,7 +422,7 @@ void misspack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl, if (gwidth[j] < ngwidthref) ngwidthref=gwidth[j]; } if (iwmax != ngwidthref) { - temp=log((double)(iwmax-ngwidthref+1))/alog2; + temp=(g2float)log((double)(iwmax-ngwidthref+1))/alog2; nbitsgwidth=(g2int)ceil(temp); for ( i=0; i 0) && (iexp < 255) ) { temp=(g2float)int_power(2.0,(iexp-127)); - a[j]=sign*temp*(1.0+(two23*(g2float)imant)); + a[j]=sign*temp*(1.0f+(two23*(g2float)imant)); } else if ( iexp == 0 ) { if ( imant != 0 ) a[j]=sign*two126*two23*(g2float)imant; else - a[j]=sign*0.0; + a[j]=sign*0.0f; } else if ( iexp == 255 ) - a[j]=sign*(1E+37); + a[j]=sign*(1E+37f); } diff --git a/src/plugins/weatherdata/gfs/g2clib/simpack.c b/src/plugins/weatherdata/gfs/g2clib/simpack.c index da389e77d..e8e6305aa 100644 --- a/src/plugins/weatherdata/gfs/g2clib/simpack.c +++ b/src/plugins/weatherdata/gfs/g2clib/simpack.c @@ -64,10 +64,10 @@ void simpack(g2float *fld,g2int ndpts,g2int *idrstmpl,unsigned char *cpack,g2int g2int j,nbits,imin,imax,maxdif,nbittot,left; g2float bscale,dscale,rmax,rmin,temp; double maxnum; - static g2float alog2=0.69314718; // ln(2.0) + static g2float alog2=0.69314718f; // ln(2.0) - bscale=int_power(2.0,-idrstmpl[1]); - dscale=int_power(10.0,idrstmpl[2]); + bscale=(g2float)int_power(2.0,-idrstmpl[1]); + dscale=(g2float)int_power(10.0,idrstmpl[2]); if (idrstmpl[3] <= 0 || idrstmpl[3] > 31) nbits=0; else @@ -102,7 +102,7 @@ void simpack(g2float *fld,g2int ndpts,g2int *idrstmpl,unsigned char *cpack,g2int imin=(g2int)rint(rmin*dscale); imax=(g2int)rint(rmax*dscale); maxdif=imax-imin; - temp=log((double)(maxdif+1))/alog2; + temp=(g2float)log((double)(maxdif+1))/alog2; nbits=(g2int)ceil(temp); rmin=(g2float)imin; // scale data @@ -117,9 +117,9 @@ void simpack(g2float *fld,g2int ndpts,g2int *idrstmpl,unsigned char *cpack,g2int rmin=rmin*dscale; rmax=rmax*dscale; maxnum=int_power(2.0,nbits)-1; - temp=log(maxnum/(rmax-rmin))/alog2; + temp=(g2float)log(maxnum/(rmax-rmin))/alog2; idrstmpl[1]=(g2int)ceil(-1.0*temp); - bscale=int_power(2.0,-idrstmpl[1]); + bscale=(g2float)int_power(2.0,-idrstmpl[1]); // scale data for (j=0;j