diff options
Diffstat (limited to 'src/H5Zscaleoffset.c')
-rw-r--r-- | src/H5Zscaleoffset.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 0aaff11..83864b9 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -347,10 +347,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Find maximum and minimum values of a buffer with fill value defined for floating-point type */ #define H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ { \ - i = 0; while(i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) i++; \ + i = 0; while(i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) i++; \ if(i < d_nelmts) min = max = buf[i]; \ for(; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ continue; /* ignore fill value */ \ if(buf[i] > max) max = buf[i]; \ if(buf[i] < min) min = buf[i]; \ @@ -394,18 +394,18 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ #define H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ { \ if(sizeof(type)==sizeof(int)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(int)*8 - 1))) { \ + if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ + > HDpow(2.0f, (double)(sizeof(int)*8 - 1))) { \ *minbits = sizeof(int)*8; goto done; \ } \ } else if(sizeof(type)==sizeof(long)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(long)*8 - 1))) { \ + if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ + > HDpow(2.0f, (double)(sizeof(long)*8 - 1))) { \ *minbits = sizeof(long)*8; goto done; \ } \ } else if(sizeof(type)==sizeof(long long)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(long long)*8 - 1))) { \ + if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ + > HDpow(2.0f, (double)(sizeof(long long)*8 - 1))) { \ *minbits = sizeof(long long)*8; goto done; \ } \ } else \ @@ -483,27 +483,27 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ *(int *)&buf[i] = (int)(((unsigned int)1 << *minbits) - 1); \ else \ *(int *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ } \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ *(long *)&buf[i] = (long)(((unsigned long)1 << *minbits) - 1); \ else \ *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ } \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ *(long long *)&buf[i] = (long long)(((unsigned long long)1 << *minbits) - 1); \ else \ *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ } \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ @@ -515,15 +515,15 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ *(int *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ } @@ -560,14 +560,14 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ - span = H5Z_scaleoffset_rnd(max * HDpow(10.0, D_val) - min * HDpow(10.0, D_val)) + 1; \ + span = H5Z_scaleoffset_rnd(max * HDpow(10.0f, D_val) - min * HDpow(10.0f, D_val)) + 1; \ *minbits = H5Z_scaleoffset_log2((unsigned long long)(span + 1)); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_1(i, type, buf, d_nelmts, filval, minbits, min, D_val) \ } else { /* fill value undefined */ \ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ - span = H5Z_scaleoffset_rnd(max * HDpow(10.0, D_val) - min * HDpow(10.0, D_val)) + 1; \ + span = H5Z_scaleoffset_rnd(max * HDpow(10.0f, D_val) - min * HDpow(10.0f, D_val)) + 1; \ *minbits = H5Z_scaleoffset_log2((unsigned long long)span); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_2(i, type, buf, d_nelmts, min, D_val) \ @@ -628,15 +628,15 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(int *)&buf[i] == (int)(((unsigned int)1 << minbits) - 1)) ? \ - filval : (double)(*(int *)&buf[i]) / HDpow(10.0, D_val) + min); \ + filval : (double)(*(int *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(long *)&buf[i] == (long)(((unsigned long)1 << minbits) - 1)) ? \ - filval : (double)(*(long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + filval : (double)(*(long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(long long *)&buf[i] == (long long)(((unsigned long long)1 << minbits) - 1)) ? \ - filval : (double)(*(long long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + filval : (double)(*(long long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -646,13 +646,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(int *)&buf[i]) / HDpow(10.0, D_val) + min); \ + buf[i] = (type)((double)(*(int *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + buf[i] = (type)((double)(*(long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(long long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + buf[i] = (type)((double)(*(long long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -1047,7 +1047,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value unsigned filavail; /* flag indicating if fill value is defined or not */ H5Z_SO_scale_type_t scale_type = H5Z_SO_FLOAT_DSCALE;/* scale type */ int scale_factor = 0; /* scale factor */ - double D_val = 0.0; /* decimal scale factor */ + double D_val = 0.0f; /* decimal scale factor */ uint32_t minbits = 0; /* minimum number of bits to store values */ unsigned long long minval= 0; /* minimum value of input buffer */ enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */ |