diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-03-01 18:48:54 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-03-01 18:48:54 (GMT) |
commit | d8e3d8e9082f0926e80e7e7010c00bda05a215b3 (patch) | |
tree | bf7717a29d0938ab15e6f54ef981e5abfcf467a5 | |
parent | ac290b5e45412a0a93fde620490d703c773d27d4 (diff) | |
download | hdf5-d8e3d8e9082f0926e80e7e7010c00bda05a215b3.zip hdf5-d8e3d8e9082f0926e80e7e7010c00bda05a215b3.tar.gz hdf5-d8e3d8e9082f0926e80e7e7010c00bda05a215b3.tar.bz2 |
[svn-r26333] Eliminates gcc warnings due to -Wunsuffixed-float-constants.
- Adds 'F' suffixes for most float constants.
- A few constants MUST be of type double. These now receive the long
double L suffix and are then cast to double. I do this via a new
H5_DOUBLE() macro which was added to H5private.h.
Fixes: HDFFV-9148
Tested on: h5committest
42 files changed, 436 insertions, 382 deletions
diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c index bddd162..b0800a0 100644 --- a/hl/test/test_dset_opt.c +++ b/hl/test/test_dset_opt.c @@ -41,7 +41,7 @@ #define CHUNK_NX 4 #define CHUNK_NY 4 -#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001F)+12) /* Temporary filter IDs used for testing */ #define H5Z_FILTER_BOGUS1 305 diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index c7a1c27..62e9ae3 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -54,14 +54,14 @@ typedef struct particle_t *------------------------------------------------------------------------- */ static particle_t testPart[NRECORDS] = { - {"zero", 0,0, 0.0f, 0.0}, - {"one", 10,10, 1.0f, 10.0}, - {"two", 20,20, 2.0f, 20.0}, - {"three",30,30, 3.0f, 30.0}, - {"four", 40,40, 4.0f, 40.0}, - {"five", 50,50, 5.0f, 50.0}, - {"six", 60,60, 6.0f, 60.0}, - {"seven",70,70, 7.0f, 70.0} + {"zero", 0,0, 0.0f, 0.0f}, + {"one", 10,10, 1.0f, 10.0f}, + {"two", 20,20, 2.0f, 20.0f}, + {"three",30,30, 3.0f, 30.0f}, + {"four", 40,40, 4.0f, 40.0f}, + {"five", 50,50, 5.0f, 50.0f}, + {"six", 60,60, 6.0f, 60.0f}, + {"seven",70,70, 7.0f, 70.0f} }; /*------------------------------------------------------------------------- diff --git a/hl/test/test_table.c b/hl/test/test_table.c index c312296..8af6d28 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -218,7 +218,7 @@ static int test_table(hid_t fid, int do_write) hsize_t chunk_size=10; int compress=0; int *fill=NULL; - particle_t fill1[1] = { {"no data",-1, -99.0f, -99.0, -1} }; + particle_t fill1[1] = { {"no data",-1, -99.0f, -99.0f, -1} }; int fill1_new[1] = { -100 }; hsize_t position; char tname[20]; @@ -246,18 +246,18 @@ static int test_table(hid_t fid, int do_write) particle2_t rbuf2[NRECORDS]; particle3_t rbuf3[NRECORDS]; particle_t rbufc[NRECORDS*2]; - particle_t abuf[2]={{"eight",80,8.0f,80.0,80},{"nine",90,9.0f,90.0,90}}; - particle_t ibuf[2]={{"zero", 0, 0.0f, 0.0, 0},{"zero", 0, 0.0f, 0.0, 0}}; + particle_t abuf[2]={{"eight",80,8.0f,80.0f,80},{"nine",90,9.0f,90.0f,90}}; + particle_t ibuf[2]={{"zero", 0, 0.0f, 0.0f, 0},{"zero", 0, 0.0f, 0.0f, 0}}; particle_t wbufd[NRECORDS]; particle_t wbuf[NRECORDS] = { - {"zero", 0, 0.0f, 0.0, 0,}, - {"one", 10, 1.0f, 10.0, 10}, - {"two", 20, 2.0f, 20.0, 20}, - {"three",30, 3.0f, 30.0, 30}, - {"four", 40, 4.0f, 40.0, 40}, - {"five", 50, 5.0f, 50.0, 50}, - {"six", 60, 6.0f, 60.0, 60}, - {"seven",70, 7.0f, 70.0, 70} + {"zero", 0, 0.0f, 0.0f, 0,}, + {"one", 10, 1.0f, 10.0f, 10}, + {"two", 20, 2.0f, 20.0f, 20}, + {"three",30, 3.0f, 30.0f, 30}, + {"four", 40, 4.0f, 40.0f, 40}, + {"five", 50, 5.0f, 50.0f, 50}, + {"six", 60, 6.0f, 60.0f, 60}, + {"seven",70, 7.0f, 70.0f, 70} }; /* buffers for the field "Pressure" and "New_field" */ float pressure_in [NRECORDS] = { 0.0f,1.0f,2.0f,3.0f,4.0f,5.0f,6.0f,7.0f }; @@ -390,14 +390,14 @@ static int test_table(hid_t fid, int do_write) /* Define an array of Particles */ particle4_t p_data[NRECORDS] = { - {12112, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, - {12113, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, - {12114, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, - {12115, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, - {12116, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, - {12117, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, - {12118, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, - {12119, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}} + {12112, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}}, + {12113, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}}, + {12114, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}}, + {12115, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}}, + {12116, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}}, + {12117, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}}, + {12118, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}}, + {12119, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}} }; /*------------------------------------------------------------------------- diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index f015b19..29d21fd 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -46,7 +46,7 @@ /******************/ /* Local Typedefs */ /******************/ -#define EXTEND_THRESHOLD .10 +#define EXTEND_THRESHOLD 0.10F /********************/ diff --git a/src/H5detect.c b/src/H5detect.c index aed7514..b902af4 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -323,7 +323,7 @@ precision (detected_t *d) * steps). This is necessary because padding bits can change arbitrarily \ * and interfere with detection of the various properties below unless we \ * know to ignore them. */ \ - _v1 = 4.0; \ + _v1 = (TYPE)4.0L; \ HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ for(_i = 0; _i < (int)sizeof(TYPE); _i++) \ for(_byte_mask = (unsigned char)1; _byte_mask; _byte_mask <<= 1) { \ @@ -335,10 +335,10 @@ precision (detected_t *d) } /* end for */ \ \ /* Byte Order */ \ - for(_i = 0, _v1 = 0.0, _v2 = 1.0; _i < (int)sizeof(TYPE); _i++) { \ + for(_i = 0, _v1 = (TYPE)0.0L, _v2 = (TYPE)1.0L; _i < (int)sizeof(TYPE); _i++) { \ _v3 = _v1; \ _v1 += _v2; \ - _v2 /= 256.0; \ + _v2 /= (TYPE)256.0L; \ HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ HDmemcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \ _j = byte_cmp(sizeof(TYPE), _buf3, _buf1, _pad_mask); \ @@ -353,20 +353,20 @@ precision (detected_t *d) INFO.is_vax = TRUE; \ \ /* Implicit mantissa bit */ \ - _v1 = 0.5; \ - _v2 = 1.0; \ + _v1 = (TYPE)0.5L; \ + _v2 = (TYPE)1.0L; \ INFO.imp = imp_bit (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ \ /* Sign bit */ \ - _v1 = 1.0; \ - _v2 = -1.0; \ + _v1 = (TYPE)1.0L; \ + _v2 = (TYPE)-1.0L; \ INFO.sign = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ \ /* Mantissa */ \ INFO.mpos = 0; \ \ - _v1 = 1.0; \ - _v2 = 1.5; \ + _v1 = (TYPE)1.0L; \ + _v2 = (TYPE)1.5L; \ INFO.msize = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ INFO.msize += 1 + (INFO.imp?0:1) - INFO.mpos; \ \ @@ -375,7 +375,7 @@ precision (detected_t *d) \ INFO.esize = INFO.sign - INFO.epos; \ \ - _v1 = 1.0; \ + _v1 = (TYPE)1.0L; \ INFO.bias = find_bias (INFO.epos, INFO.esize, INFO.perm, &_v1); \ precision (&(INFO)); \ ALIGNMENT(TYPE, INFO); \ @@ -1381,8 +1381,8 @@ detect_C89_integers(void) static void detect_C89_floats(void) { - DETECT_F(float, FLOAT, d_g[nd_g]); nd_g++; - DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++; + DETECT_F(float, FLOAT, d_g[nd_g]); nd_g++; + DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++; } diff --git a/src/H5private.h b/src/H5private.h index a532c79..1164a2d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -480,6 +480,48 @@ # define H5_DEC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)-1)) #endif +/* Double constant wrapper + * + * Quiets gcc warnings from -Wunsuffixed-float-constants. + * + * This is a really annoying warning since the standard specifies that + * constants of type double do NOT get a suffix so there's no way + * to specify a constant of type double. To quiet gcc, we specify floating + * point constants as type long double and cast to double. + * + * Note that this macro only needs to be used where using a double + * is important. For most code, suffixing constants with F will quiet the + * compiler and not produce erroneous code. + */ +#define H5_DOUBLE(S) ((double) S ## L) + +/* + * Methods to compare the equality of floating-point values: + * + * 1. H5_XXX_ABS_EQUAL - check if the difference is smaller than the + * Epsilon value. The Epsilon values, FLT_EPSILON, DBL_EPSILON, + * and LDBL_EPSILON, are defined by compiler in float.h. + * + * 2. H5_XXX_REL_EQUAL - check if the relative difference is smaller than a + * predefined value M. See if two values are relatively equal. + * It's the developer's responsibility not to pass in the value 0, which + * may cause the equation to fail. + */ +#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf(X-Y) < FLT_EPSILON) +#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs (X-Y) < DBL_EPSILON) +#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl(X-Y) < LDBL_EPSILON) + +#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf((Y-X) / X) < M) +#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs ((Y-X) / X) < M) +#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl((Y-X) / X) < M) + +/* KiB, MiB, GiB, TiB, EiB - Used in profiling and timing code */ +#define H5_KB (1024.0F) +#define H5_MB (1024.0F * 1024.0F) +#define H5_GB (1024.0F * 1024.0F * 1024.0F) +#define H5_TB (1024.0F * 1024.0F * 1024.0F * 1024.0F) +#define H5_EB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F) + /* * Data types and functions for timing certain parts of the library. */ diff --git a/src/H5timer.c b/src/H5timer.c index 301d98b..94f2883 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -90,8 +90,6 @@ * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -112,8 +110,6 @@ H5_timer_reset (H5_timer_t *timer) * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -131,18 +127,18 @@ H5_timer_begin (H5_timer_t *timer) #ifdef H5_HAVE_GETRUSAGE HDgetrusage (RUSAGE_SELF, &rusage); timer->utime = (double)rusage.ru_utime.tv_sec + - ((double)rusage.ru_utime.tv_usec / 1e6); + ((double)rusage.ru_utime.tv_usec / 1e6F); timer->stime = (double)rusage.ru_stime.tv_sec + - ((double)rusage.ru_stime.tv_usec / 1e6); + ((double)rusage.ru_stime.tv_usec / 1e6F); #else - timer->utime = 0.0; - timer->stime = 0.0; + timer->utime = 0.0F; + timer->stime = 0.0F; #endif #ifdef H5_HAVE_GETTIMEOFDAY HDgettimeofday (&etime, NULL); - timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec / 1e6); + timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec / 1e6F); #else - timer->etime = 0.0; + timer->etime = 0.0F; #endif } /* end H5_timer_begin() */ @@ -160,8 +156,6 @@ H5_timer_begin (H5_timer_t *timer) * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -170,16 +164,16 @@ H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/) H5_timer_t now; HDassert(timer); - H5_timer_begin (&now); + H5_timer_begin(&now); - timer->utime = MAX(0.0, now.utime - timer->utime); - timer->stime = MAX(0.0, now.stime - timer->stime); - timer->etime = MAX(0.0, now.etime - timer->etime); + timer->utime = MAX(0.0F, now.utime - timer->utime); + timer->stime = MAX(0.0F, now.stime - timer->stime); + timer->etime = MAX(0.0F, now.etime - timer->etime); if (sum) { - sum->utime += timer->utime; - sum->stime += timer->stime; - sum->etime += timer->etime; + sum->utime += timer->utime; + sum->stime += timer->stime; + sum->etime += timer->etime; } } /* end H5_timer_end() */ @@ -207,8 +201,6 @@ H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/) * Programmer: Robb Matzke * Wednesday, August 5, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -216,35 +208,34 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds) { double bw; - if(nseconds <= 0.0) - HDstrcpy(buf, " NaN"); + if(nseconds <= 0.0F) + HDstrcpy(buf, " NaN"); else { - bw = nbytes/nseconds; - if(HDfabs(bw) < 0.0000000001) - /* That is == 0.0, but direct comparison between floats is bad */ - HDstrcpy(buf, "0.000 B/s"); - else if(bw < 1.0) - sprintf(buf, "%10.4e", bw); - else if(bw < 1024.0) { - sprintf(buf, "%05.4f", bw); - HDstrcpy(buf+5, " B/s"); - } else if(bw < (1024.0 * 1024.0)) { - sprintf(buf, "%05.4f", bw / 1024.0); - HDstrcpy(buf+5, " kB/s"); - } else if(bw < (1024.0 * 1024.0 * 1024.0)) { - sprintf(buf, "%05.4f", bw / (1024.0 * 1024.0)); - HDstrcpy(buf+5, " MB/s"); - } else if(bw < (1024.0 * 1024.0 * 1024.0 * 1024.0)) { - sprintf(buf, "%05.4f", bw / (1024.0 * 1024.0 * 1024.0)); - HDstrcpy(buf+5, " GB/s"); - } else if(bw < (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)) { - sprintf(buf, "%05.4f", bw / (1024.0 * 1024.0 * 1024.0 * 1024.0)); - HDstrcpy(buf+5, " TB/s"); - } else { - sprintf(buf, "%10.4e", bw); - if(HDstrlen(buf) > 10) - sprintf(buf, "%10.3e", bw); - } + bw = nbytes/nseconds; + if(H5_DBL_ABS_EQUAL(bw, 0.0F)) + HDstrcpy(buf, "0.000 B/s"); + else if(bw < 1.0F) + sprintf(buf, "%10.4e", bw); + else if(bw < H5_KB) { + sprintf(buf, "%05.4f", bw); + HDstrcpy(buf+5, " B/s"); + } else if(bw < H5_MB) { + sprintf(buf, "%05.4f", bw / H5_KB); + HDstrcpy(buf+5, " kB/s"); + } else if(bw < H5_GB) { + sprintf(buf, "%05.4f", bw / H5_MB); + HDstrcpy(buf+5, " MB/s"); + } else if(bw < H5_TB) { + sprintf(buf, "%05.4f", bw / H5_GB); + HDstrcpy(buf+5, " GB/s"); + } else if(bw < H5_EB) { + sprintf(buf, "%05.4f", bw / H5_TB); + HDstrcpy(buf+5, " TB/s"); + } else { + sprintf(buf, "%10.4e", bw); + if(HDstrlen(buf) > 10) + sprintf(buf, "%10.3e", bw); + } } } /* end H5_bandwidth() */ diff --git a/src/H5trace.c b/src/H5trace.c index 3a84489..6634a2a 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -110,7 +110,7 @@ * SO MAY CAUSE H5_trace() TO BE INVOKED RECURSIVELY OR MAY * CAUSE LIBRARY INITIALIZATIONS THAT ARE NOT DESIRED. * - * Return: void + * Return: Execution time for an API call * * Programmer: Robb Matzke * Tuesday, June 16, 1998 @@ -129,34 +129,34 @@ H5_trace(const double *returning, const char *func, const char *type, ...) void *vp = NULL; FILE *out = H5_debug_g.trace; H5_timer_t event_time; - static H5_timer_t first_time = {0.0, 0.0, 0.0}; + static H5_timer_t first_time = {0.0F, 0.0F, 0.0F}; static int current_depth = 0; static int last_call_depth = 0; /* FUNC_ENTER() should not be called */ if(!out) - return 0.0; /*tracing is off*/ + return 0.0F; /*tracing is off*/ va_start(ap, type); if(H5_debug_g.ttop) { if(returning) { if(current_depth > 1) { --current_depth; - return 0.0; + return 0.0F; } /* end if */ } /* end if */ else { if(current_depth > 0) { /*do not update last_call_depth*/ current_depth++; - return 0.0; + return 0.0F; } /* end if */ } /* end else */ } /* end if */ - /* Get tim for event */ - if(HDfabs(first_time.etime) < 0.0000000001) + /* Get time for event */ + if(HDfabs(first_time.etime) < 0.0000000001F) /* That is == 0.0, but direct comparison between floats is bad */ H5_timer_begin(&first_time); if(H5_debug_g.ttimes) diff --git a/test/cache.c b/test/cache.c index 5ad1314..8725b31 100644 --- a/test/cache.c +++ b/test/cache.c @@ -20340,7 +20340,10 @@ check_auto_cache_resize(void) auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ + /* NOTE: upper_hr_threshold MUST be type double (not float) + * or the cache test will fail on 64-bit systems. + */ + auto_size_ctl.upper_hr_threshold = H5_DOUBLE(0.999); /* for ease of testing */ auto_size_ctl.decrement = 0.5f; @@ -28353,7 +28356,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */ + } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5F, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */ pass = FALSE; failure_mssg = diff --git a/test/cache_api.c b/test/cache_api.c index b1ccef1..8f556be 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -2173,7 +2173,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* long int epoch_length = */ 50000, /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, /* double lower_hr_threshold = */ 0.9f, - /* double increment = */ 0.999999999999, + /* double increment = */ H5_DOUBLE(0.999999999999), /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ @@ -2532,7 +2532,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.999f, - /* double decrement = */ 1.0000000001, + /* double decrement = */ H5_DOUBLE(1.0000000001), /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), /* int epochs_before_eviction = */ 3, @@ -2712,7 +2712,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* size_t max_decrement = */ (1 * 1024 * 1024), /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 1.00000000001, + /* double empty_reserve = */ H5_DOUBLE(1.00000000001), /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY @@ -2776,7 +2776,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double flash_multiple = */ 2.0f, /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 1.00000001, + /* double upper_hr_threshold = */ H5_DOUBLE(1.00000001), /* double decrement = */ 0.9f, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), diff --git a/test/cache_common.c b/test/cache_common.c index 7b26714..0231a11 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -5161,7 +5161,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, } else { - expected_hit_rate = 0.0; + expected_hit_rate = 0.0F; } result = H5Fget_mdc_hit_rate(file_id, &hit_rate); @@ -5171,7 +5171,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, pass = FALSE; failure_mssg = "H5Fget_mdc_hit_rate() failed."; - } else if ( ! DBL_REL_EQUAL(hit_rate, expected_hit_rate, 0.00001) ) { + } else if ( ! DBL_REL_EQUAL(hit_rate, expected_hit_rate, 0.00001F) ) { pass = FALSE; failure_mssg = "unexpected hit rate."; diff --git a/test/cross_read.c b/test/cross_read.c index 2d95d15..35dd2ce 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -100,15 +100,15 @@ static int check_data(const char *dsetname, hid_t fid, hbool_t floating_number) for (j = 0; j < NX; j++) { for (i = 0; i < NY; i++) { data_in[j][i] = ((double)(i + j + 1))/3; - data_out[j][i] = 0; + data_out[j][i] = 0.0F; int_data_in[j][i] = i + j; int_data_out[j][i] = 0; } } for (i = 0; i < NY; i++) { - data_in[NX][i] = -2.2; - data_out[NX][i] = 0; + data_in[NX][i] = -2.2F; + data_out[NX][i] = 0.0F; int_data_in[NX][i] = -2; int_data_out[NX][i] = 0; @@ -126,7 +126,7 @@ static int check_data(const char *dsetname, hid_t fid, hbool_t floating_number) /* Check results */ for (j=0; j<(NX+1); j++) { for (i=0; i<NY; i++) { - if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) { + if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001F)) { if (!nerrors++) { H5_FAILED(); printf("element [%d][%d] is %g but should have been %g\n", diff --git a/test/dsets.c b/test/dsets.c index c782e70..3244bd6 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -2814,8 +2814,8 @@ test_nbit_float(hid_t file) /* orig_data[] are initialized to be within the range that can be represented by * dataset datatype (no precision loss during datatype conversion) */ - float orig_data[2][5] = {{(float)188384.00f, (float)19.103516f, (float)-1.0831790e9f, (float)-84.242188f, - (float)5.2045898f}, {(float)-49140.000f, (float)2350.2500f, (float)-3.2110596e-1f, (float)6.4998865e-5f, (float)-0.0000000f}}; + float orig_data[2][5] = {{188384.0f, 19.103516f, -1.0831790e9f, -84.242188f, 5.2045898f}, + {-49140.0f, 2350.25f, -3.2110596e-1f, 6.4998865e-5f, -0.0f}}; float new_data[2][5]; size_t precision, offset; size_t i, j; @@ -2926,9 +2926,21 @@ test_nbit_double(hid_t file) /* orig_data[] are initialized to be within the range that can be represented by * dataset datatype (no precision loss during datatype conversion) */ - double orig_data[2][5] = {{1.6081706885101836e+60, -255.32099170994480, - 1.2677579992621376e-61, 64568.289448797700, -1.0619721778839084e-75}, {2.1499497833454840e+56, - 6.6562295504670740e-3, -1.5747263393432150, 1.0711093225222612, -9.8971679387636870e-1}}; + double orig_data[2][5] = { + { + H5_DOUBLE(1.6081706885101836e+60), + H5_DOUBLE(-255.32099170994480), + H5_DOUBLE(1.2677579992621376e-61), + H5_DOUBLE(64568.289448797700), + H5_DOUBLE(-1.0619721778839084e-75) + }, + { + H5_DOUBLE(2.1499497833454840e+56), + H5_DOUBLE(6.6562295504670740e-3), + H5_DOUBLE(-1.5747263393432150), + H5_DOUBLE(1.0711093225222612), + H5_DOUBLE(-9.8971679387636870e-1) + }}; double new_data[2][5]; size_t precision, offset; size_t i, j; @@ -3081,7 +3093,7 @@ test_nbit_array(hid_t file) for(m = 0; m < (size_t)adims[0]; m++) for(n = 0; n < (size_t)adims[1]; n++) orig_data[i][j][m][n] = (unsigned int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)precision)) << offset); + (long long)HDpow(2.0F, (double)precision)) << offset); PASSED(); /*---------------------------------------------------------------------- @@ -3175,8 +3187,8 @@ test_nbit_compound(hid_t file) hid_t dataset, space, dc; const hsize_t size[2] = {2, 5}; const hsize_t chunk_size[2] = {2, 5}; - const float float_val[2][5] = {{(float)188384.00, (float)19.103516, (float)-1.0831790e9, (float)-84.242188, - (float)5.2045898}, {(float)-49140.000, (float)2350.2500, (float)-3.2110596e-1, (float)6.4998865e-5, (float)-0.0000000}}; + const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F}, + {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}}; atomic orig_data[2][5]; atomic new_data[2][5]; unsigned int i_mask, s_mask, c_mask; @@ -3240,11 +3252,11 @@ test_nbit_compound(hid_t file) for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { orig_data[i][j].i = (int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); + (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].c = (char)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); + (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]); orig_data[i][j].s = (short)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); + (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].f = float_val[i][j]; /* some even-numbered integer values are negtive */ @@ -3369,8 +3381,8 @@ test_nbit_compound_2(hid_t file) hid_t dataset, space, dc; const hsize_t size[2] = {2, 5}; const hsize_t chunk_size[2] = {2, 5}; - const float float_val[2][5] = {{(float)188384.00, (float)19.103516, (float)-1.0831790e9, (float)-84.242188, - (float)5.2045898}, {(float)-49140.000, (float)2350.2500, (float)-3.2110596e-1, (float)6.4998865e-5, (float)-0.0000000}}; + const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F}, + {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}}; complex orig_data[2][5]; complex new_data[2][5]; unsigned int i_mask, s_mask, c_mask, b_mask; @@ -3466,29 +3478,29 @@ test_nbit_compound_2(hid_t file) for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { orig_data[i][j].a.i = (int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); + (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].a.c = (char)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); + (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]); orig_data[i][j].a.s = (short)(-((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); + (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].a.f = float_val[i][j]; orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)precision[3])) << offset[3]); + (long long)HDpow(2.0F, (double)precision[3])) << offset[3]); for(m = 0; m < (size_t)array_dims[0]; m++) for(n = 0; n < (size_t)array_dims[1]; n++) orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[4]-1))) << offset[4]); + (long long)HDpow(2.0F, (double)(precision[4]-1))) << offset[4]); for(m = 0; m < (size_t)array_dims[0]; m++) for(n = 0; n < (size_t)array_dims[1]; n++) { orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); + (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); + (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]); orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); + (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].d[m][n].f = float_val[i][j]; } } @@ -3684,7 +3696,7 @@ test_nbit_compound_3(hid_t file) /* Initialize data */ for(i = 0; i < (size_t)size[0]; i++) { HDmemset(&orig_data[i], 0, sizeof(orig_data[i])); - orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17.0 - 1.0); + orig_data[i].i = HDrandom() % (long)HDpow(2.0F, 17.0F - 1.0F); HDstrcpy(orig_data[i].str, "fixed-length C string"); orig_data[i].vl_str = HDstrdup("variable-length C string"); @@ -4436,7 +4448,7 @@ test_scaleoffset_float(hid_t file) /* Initialize data */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j] = (float)((HDrandom() % 100000) / (float)1000.0); + orig_data[i][j] = (float)((HDrandom() % 100000) / 1000.0F); /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -4469,7 +4481,7 @@ test_scaleoffset_float(hid_t file) /* Check that the values read are the same as the values written */ for(i=0; i<(size_t)size[0]; i++) { for(j=0; j<(size_t)size[1]; j++) { - if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -3.0)) { + if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -4539,7 +4551,7 @@ test_scaleoffset_float_2(hid_t file) if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* Set fill value */ - fillval = 10000.0; + fillval = 10000.0F; if(H5Pset_fill_value(dc, H5T_NATIVE_FLOAT, &fillval) < 0) goto error; /* Set up to use scaleoffset filter, decimal scale factor is 3, @@ -4567,7 +4579,7 @@ test_scaleoffset_float_2(hid_t file) /* Initialize data of hyperslab */ for(j = 0; j < (size_t)size[1]; j++) { - orig_data[0][j] = (float)((HDrandom() % 100000) / (float)1000.0); + orig_data[0][j] = (float)((HDrandom() % 100000) / 1000.0F); /* even-numbered values are negtive */ if((j+1)%2 == 0) @@ -4600,7 +4612,7 @@ test_scaleoffset_float_2(hid_t file) /* Check that the values read are the same as the values written */ for(j=0; j<(size_t)size[1]; j++) { - if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -3.0)) { + if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -4678,7 +4690,7 @@ test_scaleoffset_double(hid_t file) /* Initialize data */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0; + orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0F; /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -4711,7 +4723,7 @@ test_scaleoffset_double(hid_t file) /* Check that the values read are the same as the values written */ for(i=0; i<(size_t)size[0]; i++) { for(j=0; j<(size_t)size[1]; j++) { - if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -7.0)) { + if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -4781,7 +4793,7 @@ test_scaleoffset_double_2(hid_t file) if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* Set fill value */ - fillval = 10000.0; + fillval = 10000.0F; if(H5Pset_fill_value(dc, H5T_NATIVE_DOUBLE, &fillval) < 0) goto error; /* Set up to use scaleoffset filter, decimal scale factor is 7, @@ -4809,7 +4821,7 @@ test_scaleoffset_double_2(hid_t file) /* Initialize data of hyperslab */ for(j = 0; j < (size_t)size[1]; j++) { - orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0; + orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0F; /* even-numbered values are negtive */ if((j+1)%2 == 0) @@ -4842,7 +4854,7 @@ test_scaleoffset_double_2(hid_t file) /* Check that the values read are the same as the values written */ for(j=0; j<(size_t)size[1]; j++) { - if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -7.0)) { + if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -5609,11 +5621,11 @@ test_set_local(hid_t fapl) h5_fixname(FILENAME[5], fapl, filename, sizeof filename); /* Initialize the integer & floating-point dataset */ - n=1.0; + n=1.0F; for(i = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) { points[i][j] = (int)n++; - points_dbl[i][j] = (double)1.5*n++; + points_dbl[i][j] = (double)1.5F*n++; } /* Open file */ @@ -5807,7 +5819,7 @@ test_set_local(hid_t fapl) for(j=0; j<dims[1]; j++) { /* If the difference between two values is greater than 0.001%, they're * considered not equal. */ - if(!DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001)) { + if(!DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001F)) { H5_FAILED(); printf(" Line %d: Read different values than written.\n",__LINE__); printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); @@ -7130,7 +7142,7 @@ test_chunk_cache(hid_t fapl) /* Set new rdcc settings on fapl */ nslots_2 = nslots_1 * 2; nbytes_2 = nbytes_1 * 2; - w0_2 = w0_1 / 2.; + w0_2 = w0_1 / 2.0F; if (H5Pset_cache(fapl_local, 0, nslots_2, nbytes_2, w0_2) < 0) FAIL_STACK_ERROR h5_fixname(FILENAME[8], fapl, filename, sizeof filename); @@ -7325,7 +7337,7 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Define cache size to be smaller than chunk size */ rdcc_nelmts = BYPASS_CHUNK_DIM/5; rdcc_nbytes = sizeof(int)*BYPASS_CHUNK_DIM/5; - if(H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, (double)0.0) < 0) FAIL_STACK_ERROR + if(H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, 0.0F) < 0) FAIL_STACK_ERROR /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_local)) < 0) FAIL_STACK_ERROR diff --git a/test/dt_arith.c b/test/dt_arith.c index a93d1b8..17f8e55 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -28,7 +28,7 @@ #define NTESTELEM 10000 /* Epsilon for floating-point comparisons */ -#define FP_EPSILON 0.000001 +#define FP_EPSILON 0.000001F /* * Offset from alinged memory returned by malloc(). This can be used to test @@ -3299,7 +3299,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) { int expo_diff=check_expo[0]-check_expo[1]; int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1; - double epsilon=1.0; + double epsilon=1.0F; /* Re-scale the mantissas based on any exponent difference */ if(expo_diff!=0) diff --git a/test/dtransform.c b/test/dtransform.c index 9c78043..d80c21a 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -17,7 +17,7 @@ #define ROWS 12 #define COLS 18 -#define FLOAT_TOL 0.0001 +#define FLOAT_TOL 0.0001F static int init_test(hid_t file_id); static int test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy); diff --git a/test/fheap.c b/test/fheap.c index 96b0673..6bcd8bf 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16061,9 +16061,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Change size of data to write */ if(u < 20) - obj_size = (size_t)(obj_size * 1.3); + obj_size = (size_t)(obj_size * 1.3F); else - obj_size = (size_t)(obj_size / 1.3); + obj_size = (size_t)(obj_size / 1.3F); } /* end for */ /* Close the fractal heap */ @@ -16110,9 +16110,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Change size of data to write */ if(u < 20) - obj_size = (size_t)(obj_size * 1.3); + obj_size = (size_t)(obj_size * 1.3F); else - obj_size = (size_t)(obj_size / 1.3); + obj_size = (size_t)(obj_size / 1.3F); } /* end for */ /* Close the fractal heap */ diff --git a/test/fillval.c b/test/fillval.c index 459620d..e6e8f8e 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -909,9 +909,9 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, else if(datatype == H5T_COMPOUND) { HDmemset(buf_c, 0, ((size_t)nelmts * sizeof(comp_datatype))); for(u = 0; u < nelmts; u++) { - buf_c[u].a = (float)1111.11; + buf_c[u].a = 1111.11F; buf_c[u].x = 2222; - buf_c[u].y = 3333.3333; + buf_c[u].y = 3333.3333F; buf_c[u].z = 'd'; } if(H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0) @@ -1144,7 +1144,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) * as compound type */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; HDmemset(&fill_ctype, 0, sizeof(fill_ctype)); - fill_ctype.y = 4444.4444; + fill_ctype.y = 4444.4444F; if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND, ctype_id); @@ -1197,7 +1197,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) * as compound type */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; HDmemset(&fill_ctype, 0, sizeof(fill_ctype)); - fill_ctype.y = 4444.4444; + fill_ctype.y = 4444.4444F; if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND, ctype_id); diff --git a/test/flush2.c b/test/flush2.c index 06dd086..8108bba 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -73,13 +73,13 @@ check_dset(hid_t file, const char* name) * 1998-11-06 ptl */ error = fabs(the_data[i][j] - (double)(hssize_t)i / ((hssize_t)j + 1)); - if(error > 0.0001) { - H5_FAILED(); - printf(" dset[%lu][%lu] = %g\n", - (unsigned long)i, (unsigned long)j, the_data[i][j]); - printf(" should be %g\n", - (double)(hssize_t)i/(hssize_t)(j+1)); - goto error; + if(error > 0.0001F) { + H5_FAILED(); + printf(" dset[%lu][%lu] = %g\n", + (unsigned long)i, (unsigned long)j, the_data[i][j]); + printf(" should be %g\n", + (double)(hssize_t)i/(hssize_t)(j+1)); + goto error; } } if(H5Dclose(dset) < 0) goto error; diff --git a/test/hyperslab.c b/test/hyperslab.c index 5e2c109..9bc085c 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -609,10 +609,10 @@ test_multifill(size_t nx) for(i = 0; i < nx; i++) { src[i].left = 1111111; - src[i].mid = 12345.6789; + src[i].mid = 12345.6789F; src[i].right = 2222222; dst[i].left = 3333333; - dst[i].mid = 98765.4321; + dst[i].mid = 98765.4321F; dst[i].right = 4444444; } /* end for */ @@ -621,7 +621,7 @@ test_multifill(size_t nx) * over and over again. */ fill.left = 55555555; - fill.mid = 3.1415927; + fill.mid = 3.1415927F; fill.right = 66666666; src_stride = 0; diff --git a/test/links.c b/test/links.c index 6119bb3..891b5e4 100644 --- a/test/links.c +++ b/test/links.c @@ -141,7 +141,7 @@ const char *FILENAME[] = { #define H5L_DIM1 100 #define H5L_DIM2 100 -#define FILTER_FILESIZE_MAX_FRACTION .9 +#define FILTER_FILESIZE_MAX_FRACTION 0.9F /* Creation order macros */ #define CORDER_GROUP_NAME "corder_group" diff --git a/test/mtime.c b/test/mtime.c index 6e00fe0..0c0c923 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -114,7 +114,7 @@ main(void) puts(" Modification times will be mantained in the file but"); puts(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; - } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0) { + } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0F) { H5_FAILED(); tm = HDlocaltime(&(oi1.ctime)); HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); diff --git a/test/objcopy.c b/test/objcopy.c index 0a1d7a0..71a7236 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2315,7 +2315,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t #endif /* H5_CLEAR_MEMORY */ for(i = 0; i < DIM_SIZE_1; i++) { buf[i].a = i; - buf[i].d = 1. / (i + 1); + buf[i].d = 1.0F / (i + 1); } /* end for */ /* Initialize the filenames */ @@ -2447,9 +2447,9 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* set initial data values */ for(i = 0; i < DIM_SIZE_1; i++) { - buf1d[i] = (float)(i / 2.0); + buf1d[i] = (float)(i / 2.0F); for(j = 0; j < DIM_SIZE_2; j++) - buf2d[i][j] = (float)(i + (j / 100.0)); + buf2d[i][j] = (float)(i + (j / 100.0F)); } /* end for */ /* Initialize the filenames */ @@ -2790,9 +2790,9 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* set initial data values */ for(i = 0; i < DIM_SIZE_1; i++) { - buf1d[i] = (float)(i / 10.0); + buf1d[i] = (float)(i / 10.0F); for(j = 0; j < DIM_SIZE_2; j++) - buf2d[i][j] = (float)(i + (j / 100.0)); + buf2d[i][j] = (float)(i + (j / 100.0F)); } /* end for */ /* Initialize the filenames */ @@ -2985,7 +2985,7 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* set initial data values */ for (i=0; i<DIM_SIZE_1; i++) for (j=0; j<DIM_SIZE_2; j++) - buf[i][j] = (float)(100.0); /* Something easy to compress */ + buf[i][j] = 100.0F; /* Something easy to compress */ /* Initialize the filenames */ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); @@ -3114,7 +3114,7 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* set initial data values */ for (i=0; i<DIM_SIZE_1; i++) for (j=0; j<DIM_SIZE_2; j++) - buf[i][j] = (float)(i+j/100.0); + buf[i][j] = (float)(i+j/100.0F); /* Initialize the filenames */ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); @@ -7591,7 +7591,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int)); for(j = 0; j < buf[i].b.len; j++) ((int *)buf[i].b.p)[j] = (int)(i * 10 + j); - buf[i].c = 1. / (i + 1.); + buf[i].c = 1.0F / (i + 1.0F); } /* end for */ /* Initialize the filenames */ @@ -7730,7 +7730,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int)); for(j = 0; j < buf[i].b.len; j++) ((int *)buf[i].b.p)[j] = (int)(i * 10 + j); - buf[i].c = 1. / (i + 1.); + buf[i].c = 1.0F / (i + 1.0F); } /* end for */ /* Initialize the filenames */ @@ -7875,7 +7875,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int)); for(j = 0; j < buf[i].b.len; j++) ((int *)buf[i].b.p)[j] = (int)(i * 10 + j); - buf[i].c = 1. / (i + 1.); + buf[i].c = 1.0F / (i + 1.0F); } /* end for */ /* Initialize the filenames */ diff --git a/test/set_extent.c b/test/set_extent.c index aaa6516..f6c3766 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -130,10 +130,10 @@ int main( void ) if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR /* Set chunk cache so only part of the chunks can be cached on fapl */ - if(H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR + if(H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75F) < 0) TEST_ERROR /* Disable chunk caching on fapl2 */ - if(H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.) < 0) TEST_ERROR + if(H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0F) < 0) TEST_ERROR /* Set the "use the latest version of the format" bounds for creating objects in the file */ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR diff --git a/test/tarray.c b/test/tarray.c index 1a53336..e3d7c37 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -541,7 +541,7 @@ test_array_compound_atomic(void) for(i = 0; i < SPACE1_DIM1; i++) for(j = 0; j < ARRAY1_DIM1; j++) { wdata[i][j].i = i * 10 + j; - wdata[i][j].f = (float)(i * 2.5 + j); + wdata[i][j].f = (float)(i * 2.5F + j); } /* end for */ /* Create file */ @@ -745,7 +745,7 @@ test_array_compound_array(void) for(j=0; j<ARRAY1_DIM1; j++) { wdata[i][j].i=i*10+j; for(k=0; k<ARRAY1_DIM1; k++) - wdata[i][j].f[k]=(float)(i*10+j*2.5+k); + wdata[i][j].f[k]=(float)(i * 10.0F + j * 2.5F + k); } /* end for */ /* Create file */ @@ -1534,8 +1534,8 @@ test_array_bkg(void) for (j = 0; j < ALEN; j++) { cf[i].a[j] = 100*(i+1) + j; - cf[i].b[j] = (float)(100.*(i+1) + 0.01*j); - cf[i].c[j] = 100.*(i+1) + 0.02*j; + cf[i].b[j] = (float)(100.0F*(i+1) + 0.01F*j); + cf[i].c[j] = (double)(100.0F*(i+1) + 0.02F*j); } } @@ -1674,7 +1674,7 @@ test_array_bkg(void) /* -------------------------------- */ for (i=0; i< LENGTH; i++) for (j = 0; j < ALEN; j++) - cf[i].b[j]=fld[i].b[j] = (float)1.313; + cf[i].b[j]=fld[i].b[j] = 1.313F; status = H5Dwrite (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld); CHECK(status, FAIL, "H5Dwrite"); diff --git a/test/tattr.c b/test/tattr.c index 2885124..57d19ff 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -97,7 +97,7 @@ int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data f #define ATTR3_DIM1 2 #define ATTR3_DIM2 2 #define ATTR3_DIM3 2 -double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3,-26.1},{0.123,-10.0}},{{973.23,-0.91827},{2.0,23.0}}}; /* Test data for 3rd attribute */ +double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3F,-26.1F}, {0.123F,-10.0F}},{{973.23F,-0.91827F},{2.0F,23.0F}}}; /* Test data for 3rd attribute */ #define ATTR4_NAME "Attr4" #define ATTR4_RANK 2 @@ -113,12 +113,12 @@ struct attr4_struct { int i; double d; char c; - } attr_data4[ATTR4_DIM1][ATTR4_DIM2]={{{3,-26.1,'d'},{-100000, 0.123,'3'}}, - {{-23,981724.2,'Q'},{0,2.0,'\n'}}}; /* Test data for 4th attribute */ + } attr_data4[ATTR4_DIM1][ATTR4_DIM2]={{{3,-26.1F,'d'},{-100000, 0.123F,'3'}}, + {{-23,981724.2F,'Q'},{0,2.0F,'\n'}}}; /* Test data for 4th attribute */ #define ATTR5_NAME "Attr5" #define ATTR5_RANK 0 -float attr_data5=(float)-5.123; /* Test data for 5th attribute */ +float attr_data5=-5.123F; /* Test data for 5th attribute */ #define ATTR6_RANK 3 #define ATTR6_DIM1 100 @@ -500,7 +500,7 @@ test_attr_flush(hid_t fapl) att, /* Attribute ID */ spc, /* Dataspace ID */ set; /* Dataset ID */ - double wdata=3.14159; /* Data to write */ + double wdata=3.14159F; /* Data to write */ double rdata; /* Data read in */ herr_t ret; /* Generic return value */ @@ -522,8 +522,8 @@ test_attr_flush(hid_t fapl) ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(!DBL_ABS_EQUAL(rdata,0.0)) - TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0); + if(!DBL_ABS_EQUAL(rdata,0.0F)) + TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0F); ret=H5Fflush(fil, H5F_SCOPE_GLOBAL); CHECK(ret, FAIL, "H5Fflush"); @@ -531,8 +531,8 @@ test_attr_flush(hid_t fapl) ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(!DBL_ABS_EQUAL(rdata,0.0)) - TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0); + if(!DBL_ABS_EQUAL(rdata,0.0F)) + TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0F); ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata); CHECK(ret, FAIL, "H5Awrite"); @@ -985,7 +985,7 @@ test_attr_scalar_read(hid_t fapl) hid_t sid; /* Dataspace ID */ hid_t attr; /* Attribute ID */ H5S_class_t stype; /* Dataspace class */ - float rdata = 0.0; /* Buffer for reading 1st attribute */ + float rdata = 0.0F; /* Buffer for reading 1st attribute */ H5O_info_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ diff --git a/test/tfile.c b/test/tfile.c index 5de035a..52c8fd9 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -2362,7 +2362,7 @@ test_rw_noupdate(void) diff = HDdifftime(sb2.st_mtime, sb1.st_mtime); /* Check That Timestamps Are Equal */ - if(diff > 0.0) { + if(diff > 0.0F) { /* Output message about test being performed */ MESSAGE(1, ("Testing to verify that nothing is written if nothing is changed: This test is skipped on this system because the modification time from stat is the same as the last access time (We know OpenVMS behaves in this way).\n")); } /* end if */ @@ -2395,7 +2395,7 @@ test_rw_noupdate(void) /* Ensure That Timestamps Are Equal */ diff = HDdifftime(sb2.st_mtime, sb1.st_mtime); - ret = (diff > 0.0); + ret = (diff > 0.0F); VERIFY(ret, 0, "Timestamp"); } /* end else */ } /* end test_rw_noupdate() */ diff --git a/test/tgenprop.c b/test/tgenprop.c index 004e346..d147099 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -47,7 +47,7 @@ int prop1_def=10; /* Property 1 default value */ #define PROP1_DEF_VALUE (&prop1_def) #define PROP2_NAME "Property 2" -float prop2_def=(float)3.14; /* Property 2 default value */ +float prop2_def=3.14F; /* Property 2 default value */ #define PROP2_SIZE sizeof(prop2_def) #define PROP2_DEF_VALUE (&prop2_def) @@ -57,7 +57,7 @@ char prop3_def[10]="Ten chars"; /* Property 3 default value */ #define PROP3_DEF_VALUE (&prop3_def) #define PROP4_NAME "Property 4" -double prop4_def=1.41; /* Property 4 default value */ +double prop4_def=1.41F; /* Property 4 default value */ #define PROP4_SIZE sizeof(prop4_def) #define PROP4_DEF_VALUE (&prop4_def) diff --git a/test/th5s.c b/test/th5s.c index d3a651c..94268a7 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -79,7 +79,7 @@ struct space4_struct { unsigned u; float f; char c2; - } space4_data={'v',987123,(float)-3.14,'g'}; /* Test data for 4th dataspace */ + } space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */ /**************************************************************** ** @@ -1647,7 +1647,7 @@ test_h5s_chunk(void) /* Initialize float array */ for(i = 0; i < 50000; i++) for(j = 0; j < 3; j++) - chunk_data_flt[i][j] = (float)((i + 1) * 2.5 - j * 100.3); + chunk_data_flt[i][j] = (float)((i + 1) * 2.5F - j * 100.3F); status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt); CHECK(status, FAIL, "H5Dwrite"); @@ -1683,7 +1683,7 @@ test_h5s_chunk(void) for(i=0; i<50000; i++) { for(j=0; j<3; j++) { /* Check if the two values are within 0.001% range. */ - if(!DBL_REL_EQUAL(chunk_data_dbl[i][j], chunk_data_flt[i][j], 0.00001)) + if(!DBL_REL_EQUAL(chunk_data_dbl[i][j], chunk_data_flt[i][j], 0.00001F)) TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, chunk_data_flt[i][j]); } /* end for */ } /* end for */ diff --git a/test/tmisc.c b/test/tmisc.c index cac6b04..cffb3df 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2427,17 +2427,17 @@ test_misc13(void) static void test_misc14(void) { - hid_t file_id; /* File ID */ - hid_t fapl; /* File access property list ID */ - hid_t DataSpace; /* Dataspace ID */ - hid_t Dataset1; /* Dataset ID #1 */ - hid_t Dataset2; /* Dataset ID #2 */ - hid_t Dataset3; /* Dataset ID #3 */ - double data1 = 5.0; /* Data to write for dataset #1 */ - double data2 = 10.0; /* Data to write for dataset #2 */ - double data3 = 15.0; /* Data to write for dataset #3 */ - double rdata; /* Data read in */ - herr_t ret; /* Generic return value */ + hid_t file_id; /* File ID */ + hid_t fapl; /* File access property list ID */ + hid_t DataSpace; /* Dataspace ID */ + hid_t Dataset1; /* Dataset ID #1 */ + hid_t Dataset2; /* Dataset ID #2 */ + hid_t Dataset3; /* Dataset ID #3 */ + double data1 = 5.0F; /* Data to write for dataset #1 */ + double data2 = 10.0F; /* Data to write for dataset #2 */ + double data3 = 15.0F; /* Data to write for dataset #3 */ + double rdata; /* Data read in */ + herr_t ret; /* Generic return value */ /* Test creating two datasets and deleting the second */ @@ -4949,7 +4949,7 @@ test_misc28(void) * bytes). */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75); + ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75F); CHECK(ret, FAIL, "H5Pset_cache"); /* Create the dcpl and set the chunk size */ diff --git a/test/tsohm.c b/test/tsohm.c index 8ebfd52..9da655e 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -57,7 +57,7 @@ const unsigned test_minsizes[H5O_SHMESG_MAX_NINDEXES] = {0, 2, 40, 100, 3, 1000} #define NAME_BUF_SIZE 512 /* How much overhead counts as "not much" when converting B-trees, etc. */ -#define OVERHEAD_ALLOWED 1.15 +#define OVERHEAD_ALLOWED 1.15F #define NUM_DATASETS 10 #define NUM_ATTRIBUTES 100 @@ -600,7 +600,7 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos wdata.i6 = 66; wdata.i7 = 77; wdata.i8 = 88; - wdata.f1 = 0.0; + wdata.f1 = 0.0F; /* Intialize rdata */ HDmemset(&rdata, 0, sizeof(rdata)); diff --git a/test/tunicode.c b/test/tunicode.c index 7dc3391..82dc429 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -39,8 +39,8 @@ #define RANK 1 #define COMP_INT_VAL 7 -#define COMP_FLOAT_VAL -42.0 -#define COMP_DOUBLE_VAL 42.0 +#define COMP_FLOAT_VAL -42.0F +#define COMP_DOUBLE_VAL 42.0F /* Test function prototypes */ void test_fl_string(hid_t fid, const char *string); diff --git a/test/tvltypes.c b/test/tvltypes.c index 516974e..2928e57 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -731,7 +731,7 @@ test_vltypes_vlen_compound(void) wdata[i].len=i+1; for(j=0; j<(i+1); j++) { ((s1 *)wdata[i].p)[j].i=i*10+j; - ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0); + ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F); } /* end for */ } /* end for */ @@ -877,7 +877,7 @@ rewrite_vltypes_vlen_compound(void) wdata[i].len = i + increment; for(j = 0; j < (i + increment); j++) { ((s1 *)wdata[i].p)[j].i = i * 40 + j; - ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0); + ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0F); } /* end for */ } /* end for */ @@ -1018,7 +1018,7 @@ test_vltypes_compound_vlen_vlen(void) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE3_DIM1; i++) { wdata[i].i=i*10; - wdata[i].f=(float)((i*20)/3.0); + wdata[i].f=(float)((i*20)/3.0F); wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t)); wdata[i].v.len=i+L1_INCM; for(t1=(wdata[i].v).p,j=0; j<(i+L1_INCM); j++, t1++) { @@ -1479,7 +1479,7 @@ test_vltypes_compound_vlen_atomic(void) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { wdata[i].i=i*10; - wdata[i].f=(float)((i*20)/3.0); + wdata[i].f=(float)((i*20)/3.0F); wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int)); wdata[i].v.len=i+1; for(j=0; j<(i+1); j++) @@ -1595,7 +1595,7 @@ test_vltypes_compound_vlen_atomic(void) /* Check data read in */ for(i = 0; i < SPACE1_DIM1; i++) - if(rdata[i].i != 0 || !FLT_ABS_EQUAL(rdata[i].f, 0.0) || rdata[i].v.len != 0 || rdata[i].v.p != NULL) + if(rdata[i].i != 0 || !FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 || rdata[i].v.p != NULL) TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p); /* Write dataset to disk */ @@ -1697,7 +1697,7 @@ rewrite_vltypes_compound_vlen_atomic(void) /* Allocate and initialize VL data to write */ for(i = 0; i < SPACE1_DIM1; i++) { wdata[i].i = i * 40; - wdata[i].f = (float)((i * 50) / 3.0); + wdata[i].f = (float)((i * 50) / 3.0F); wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int)); wdata[i].v.len = i + increment; for(j = 0; j < (i + increment); j++) @@ -2430,8 +2430,8 @@ test_vltypes_fill_value(void) hsize_t small_dims[] = {SPACE4_DIM_SMALL}; hsize_t large_dims[] = {SPACE4_DIM_LARGE}; size_t dset_elmts; /* Number of elements in a particular dataset */ - const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", 3, 4.0, 100.0, 1.0, "liquid", "meter"}; - const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0, 200.0, 2.0, "solid", "yard"}; + const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"}; + const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0F, 200.0F, 2.0F, "solid", "yard"}; dtype1_struct *rbuf = NULL; /* Buffer for reading data */ size_t mem_used = 0; /* Memory used during allocation */ H5D_layout_t layout; /* Dataset storage layout */ diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 80405e9..1b80317 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -317,10 +317,10 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) */ { - double data1[3][2] = {{1,1}, {1,1}, {0,0}}; - double data2[3][2] = {{0,1.1},{1.01,1.001},{0,1}}; - double data3[3][2] = {{100,100},{100,100},{100,100}}; - double data4[3][2] = {{105,120},{160,95},{80,40}}; + double data1[3][2] = {{ 1.0F, 1.0F}, { 1.00F, 1.000F}, { 0.0F, 0.0F}}; + double data2[3][2] = {{ 0.0F, 1.1F}, { 1.01F, 1.001F}, { 0.0F, 1.0F}}; + double data3[3][2] = {{100.0F, 100.0F}, {100.00F, 100.000F}, {100.0F, 100.0F}}; + double data4[3][2] = {{105.0F, 120.0F}, {160.00F, 95.000F}, { 80.0F, 40.0F}}; write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1); write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_DOUBLE,data2); @@ -371,8 +371,8 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - double data9[3][2] = {{100,100},{100,0},{0,100}}; - double data10[3][2] ={{120,80}, {0,100},{0,50}}; + double data9[3][2] = {{100.0F, 100.0F}, {100.0F, 0.0F}, {0.0F, 100.0F}}; + double data10[3][2] ={{120.0F, 80.0F}, { 0.0F, 100.0F}, {0.0F, 50.0F}}; write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9); write_dset(gid1,2,dims2,"dset10",H5T_NATIVE_DOUBLE,data10); @@ -393,8 +393,14 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) /* epsilon = 0.0000000000000001 = 1e-16 * system epsilon for double : DBL_EPSILON = 2.22045E-16 */ - double data13[3][2] ={{0.0000000000000000, 0.0000000000000001},{0.0000000000000001, 0.0000000000000000},{0.00000000000000033, 0.0000000000000001}}; - double data14[3][2] ={{0.0000000000000000, 0.0000000000000004},{0.0000000000000002, 0.0000000000000001},{0.0000000000000001, 0.00000000000000000}}; + double data13[3][2] ={ + {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000001)}, + {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.0000000000000000)}, + {H5_DOUBLE(0.00000000000000033), H5_DOUBLE(0.0000000000000001)}}; + double data14[3][2] ={ + {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000004)}, + {H5_DOUBLE(0.0000000000000002), H5_DOUBLE(0.0000000000000001)}, + {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.00000000000000000)}}; write_dset(gid1,2,dims2,"fp1",H5T_NATIVE_FLOAT,data11); write_dset(gid1,2,dims2,"fp2",H5T_NATIVE_FLOAT,data12); @@ -412,7 +418,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ - long double data15[3][2] ={{1,1},{1,1},{1,1}}; + long double data15[3][2] ={{1.0L,1.0L},{1.0L,1.0L},{1.0L,1.0L}}; write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15); @@ -430,19 +436,19 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) float data15[6]; float data16[6]; - data15[0] = (float) sqrt( (double)-1 ); - data15[1] = 1; - data15[2] = (float) sqrt( (double)-1 ); - data15[3] = 1; - data15[4] = 1; - data15[5] = 1; + data15[0] = (float)HDsqrt(-1.0F); + data15[1] = 1.0F; + data15[2] = (float)HDsqrt(-1.0F); + data15[3] = 1.0F; + data15[4] = 1.0F; + data15[5] = 1.0F; - data16[0] = (float) sqrt( (double)-1 ); - data16[1] = (float) sqrt( (double)-1 ); - data16[2] = 1; - data16[3] = 1; - data16[4] = 1; - data16[5] = 1; + data16[0] = (float)HDsqrt(-1.0F); + data16[1] = (float)HDsqrt(-1.0F); + data16[2] = 1.0F; + data16[3] = 1.0F; + data16[4] = 1.0F; + data16[5] = 1.0F; write_dset(gid1,1,dims1,"fp15",H5T_NATIVE_FLOAT,data15); write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16); @@ -458,19 +464,19 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) double data17[6]; double data18[6]; - data17[0] = sqrt( (double)-1 ); - data17[1] = 1; - data17[2] = sqrt( (double)-1 ); - data17[3] = 1; - data17[4] = 1; - data17[5] = 1; + data17[0] = HDsqrt(-1.0F); + data17[1] = 1.0F; + data17[2] = HDsqrt(-1.0F); + data17[3] = 1.0F; + data17[4] = 1.0F; + data17[5] = 1.0F; - data18[0] = (float) sqrt( (double)-1 ); - data18[1] = (float) sqrt( (double)-10000 ); - data18[2] = 1; - data18[3] = 1; - data18[4] = 1; - data18[5] = 1; + data18[0] = HDsqrt(-1.0F); + data18[1] = HDsqrt(-10000.0F); + data18[2] = 1.0F; + data18[3] = 1.0F; + data18[4] = 1.0F; + data18[5] = 1.0F; write_dset(gid1,1,dims1,"fp17",H5T_NATIVE_DOUBLE,data17); write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18); @@ -485,11 +491,11 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) float data19[6]; double data20[6]; - data19[0] = data19[1] = data19[2] = log(0); - data19[3] = data19[4] = data19[5] = -log(0); + data19[0] = data19[1] = data19[2] = (float)HDlog(0.0F); + data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0F); - data20[0] = data20[1] = data20[2] = log(0); - data20[3] = data20[4] = data20[5] = -log(0); + data20[0] = data20[1] = data20[2] = HDlog(0.0F); + data20[3] = data20[4] = data20[5] = -HDlog(0.0F); write_dset(gid1,1,dims1,"fp19",H5T_NATIVE_FLOAT,data19); write_dset(gid1,1,dims1,"fp19_COPY",H5T_NATIVE_FLOAT,data19); @@ -514,15 +520,15 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) size_t type_size; hid_t tid; - buf1[0].d = sqrt( (double)-1 ); - buf1[0].f = (float) sqrt( (double)-1 ); - buf2[0].d = sqrt( (double)-1 ); - buf2[0].f = (float) sqrt( (double)-1 ); + buf1[0].d = HDsqrt(-1.0F); + buf1[0].f = (float)HDsqrt(-1.0F); + buf2[0].d = HDsqrt(-1.0F); + buf2[0].f = (float)HDsqrt(-1.0F); - buf1[1].d = sqrt( (double)-1 ); - buf1[1].f = (float) sqrt( (double)-1 ); - buf2[1].d = 0; - buf2[1].f = 0; + buf1[1].d = HDsqrt(-1.0F); + buf1[1].f = (float)HDsqrt(-1.0F); + buf2[1].d = 0.0F; + buf2[1].f = 0.0F; type_size = sizeof( cmp1_t ); tid = H5Tcreate (H5T_COMPOUND, type_size ); @@ -555,7 +561,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) int i; } cmp3_t; - double data2[6] = {0,0,0,0,0,0}; + double data2[6] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; int data3[6] = {0,0,0,0,0,0}; int data4[3][2] = {{0,0},{0,0},{0,0}}; int data5[2][2] = {{0,0},{0,0}}; @@ -770,10 +776,10 @@ int test_datatypes(const char *fname) int buf3b[3][2] = {{1,1},{3,4},{5,6}}; long buf4a[3][2] = {{1,1},{1,1},{1,1}}; long buf4b[3][2] = {{1,1},{3,4},{5,6}}; - float buf5a[3][2] = {{1,1},{1,1},{1,1}}; - float buf5b[3][2] = {{1,1},{3,4},{5,6}}; - double buf6a[3][2] = {{1,1},{1,1},{1,1}}; - double buf6b[3][2] = {{1,1},{3,4},{5,6}}; + float buf5a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}}; + float buf5b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; + double buf6a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}}; + double buf6b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /*unsigned/signed test signed char -128 to 127 @@ -1025,10 +1031,10 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) /* file1 attr */ int f1_attr_idata[2]= {1,2}; /* integer */ - float f1_attr_fdata[2]= {1.1,2.2}; /* float */ + float f1_attr_fdata[2]= {1.1F,2.2F}; /* float */ /* file2 attr */ int f2_attr_idata[2]= {2,3}; /* integer */ - float f2_attr_fdata[2]= {2.1,3.2}; /* float */ + float f2_attr_fdata[2]= {2.1F,3.2F}; /* float */ /*---------------------------------------------------------------------- @@ -4363,7 +4369,7 @@ static void test_comps_array (const char *fname, const char *dset, const char *a for(j=0; j < SDIM_CMPD_ARRAY; j++) { wdata[i].cmpd2[j].i2 = i*10 + diff; - wdata[i].cmpd2[j].f2 = (float)(i*10.5) + diff; + wdata[i].cmpd2[j].f2 = (float)(i*10.5F) + diff; } /* end for */ } @@ -4480,7 +4486,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a for(j=0; j<(i+1); j++) { ((cmpd2_t *)wdata[i].vl.p)[j].i2 = i*10 + diff; - ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)(i*10.5) + diff; + ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)(i*10.5F) + diff; } /* end for */ } /* end for */ @@ -4606,7 +4612,7 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch { /* Initialize data of compound3 */ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = j*10 + diff; - ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)(j*10.5) + diff; + ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)(j*10.5F) + diff; } /* end for */ } /* end for */ } @@ -4753,8 +4759,8 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch for (k=0; k < SDIM_CMPD_ARRAY; k++) { /* compound 3 data */ - ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = k*10.5 + diff; - ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)(k*10.5) + diff; + ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = k*10.5F + diff; + ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)(k*10.5F) + diff; } } /* end for */ } /* end for */ @@ -5246,27 +5252,27 @@ void write_attr_in(hid_t loc_id, char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ char *buf1a[2]; /* VL string */ char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2},{3,4}}; /* compound */ + s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ e_t buf45[2]= {RED,RED}; /* enum */ hvl_t buf5[2]; /* vlen */ hsize_t dimarray[1]={3}; /* array dimension */ int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1,2}; /* float */ + float buf8[2]= {1.0F, 2.0F}; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; - char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ - char *buf12a[3][2]; /* VL string */ - char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ - s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - e_t buf452[3][2]; /* enum */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ - int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ + char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ + char *buf12a[3][2]; /* VL string */ + char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ + s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + e_t buf452[3][2]; /* enum */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ + int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ + float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; @@ -6017,7 +6023,7 @@ void write_attr_in(hid_t loc_id, for (k = 0; k < 2; k++) { if (make_diffs) { buf33[i][j][k].a=0; - buf33[i][j][k].b=0; + buf33[i][j][k].b=0.0F; } else { buf33[i][j][k].a=n++; @@ -6231,7 +6237,7 @@ void write_attr_in(hid_t loc_id, for (k = 0; k < 2; k++) { if (make_diffs) { buf73[i][j][k]=0; - buf83[i][j][k]=0; + buf83[i][j][k]=0.0F; } else { buf73[i][j][k]=n++; @@ -6303,26 +6309,26 @@ void write_dset_in(hid_t loc_id, char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ char *buf1a[2]; /* VL string */ char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2},{3,4}}; /* compound */ + s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ e_t buf45[2]= {RED,GREEN}; /* enum */ hvl_t buf5[2]; /* vlen */ hsize_t dimarray[1]={3}; /* array dimension */ int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1,2}; /* float */ + float buf8[2]= {1.0F,2.0F}; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ char *buf12a[3][2]; /* VL string */ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ - s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ + s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ hvl_t buf52[3][2]; /* vlen */ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ + float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; @@ -6859,7 +6865,7 @@ void write_dset_in(hid_t loc_id, if (make_diffs) { buf33[i][j][k].a=0; - buf33[i][j][k].b=0; + buf33[i][j][k].b=0.0F; } else { buf33[i][j][k].a=n++; @@ -6968,7 +6974,7 @@ void write_dset_in(hid_t loc_id, for (k = 0; k < 2; k++) { if (make_diffs) { buf73[i][j][k]=0; - buf83[i][j][k]=0; + buf83[i][j][k]=0.0F; } else { buf73[i][j][k]=n++; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 36c9642..c04afe9 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -429,7 +429,7 @@ gent_dataset(void) for(i = 0; i < 30; i++) for(j = 0; j < 20; j++) - dset2[i][j] = 0.0001 * j + i; + dset2[i][j] = 0.0001F * j + i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); @@ -524,7 +524,7 @@ gent_attribute(void) space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT); - for(i = 0; i < 10; i++) d[i] = 0.1 * i; + for(i = 0; i < 10; i++) d[i] = 0.1F * i; H5Awrite(attr, H5T_NATIVE_DOUBLE, d); H5Sclose(space); @@ -952,16 +952,16 @@ static void gent_compound_dt(void) { /* test compound data type */ for(i = 0; i < (int)sdim; i++) { dset1[i].a = i; dset1[i].b = (float)(i*i); - dset1[i].c = (float)(1./(i+1)); + dset1[i].c = (float)(1.0F/(i+1)); dset2[i].a = i; - dset2[i].b = (float)(i+ i*0.1); + dset2[i].b = (float)(i+ i*0.1F); dset4[i].a = i; dset4[i].b = (float)(i+3); dset5[i].a = i; - dset5[i].b = (float)(i*0.1); + dset5[i].b = (float)(i*0.1F); } @@ -1137,16 +1137,16 @@ static void gent_compound_dt2(void) { /* test compound data type */ for(i = 0; i < (int)sdim; i++) { dset1[i].a = i; dset1[i].b = (float)(i*i); - dset1[i].c = (float)(1./(i+1)); + dset1[i].c = (float)(1.0F/(i+1)); dset2[i].a = i; - dset2[i].b = (float)(i+ i*0.1); + dset2[i].b = (float)(i+ i*0.1F); dset4[i].a = i; - dset4[i].b = (float)(i*1.0); + dset4[i].b = (float)(i*1.0F); dset5[i].a = i; - dset5[i].b = (float)(i*1.0); + dset5[i].b = (float)(i*1.0F); } fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -1386,7 +1386,7 @@ static void gent_all(void) space = H5Screate_simple(1, dims, NULL); dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 10; i++) - dset2_1[i] = (float)(i * 0.1 + 1); + dset2_1[i] = (float)(i * 0.1F + 1); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); H5Sclose(space); H5Dclose(dataset); @@ -1397,7 +1397,7 @@ static void gent_all(void) dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 3; i++) for(j = 0; j < 5; j++) - dset2_2[i][j] = (float)((i + 1) * j * 0.1); + dset2_2[i][j] = (float)((i + 1) * j * 0.1F); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2); H5Sclose(space); H5Dclose(dataset); @@ -1565,7 +1565,7 @@ gent_many(void) space2 = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 10; i++) - d[i] = 0.1 * i; + d[i] = 0.1F * i; H5Awrite(attr, H5T_NATIVE_DOUBLE, d); H5Sclose(space2); H5Aclose(attr); @@ -2378,10 +2378,10 @@ static void gent_nestcomp(void) for(i = 0; i< 10; i++) { s1[i].a = i; s1[i].b = (float)(i*i); - s1[i].c = 1./(i+1); + s1[i].c = 1.0F/(i+1); s1[i].d.a = 65 + i; - s1[i].d.b[0] = -100.; - s1[i].d.b[1] = 100.; + s1[i].d.b[0] = -100.0F; + s1[i].d.b[1] = 100.0F; } /* @@ -2582,7 +2582,7 @@ static void gent_vldatatypes(void) wdata[i].len = i + 1; for(j = 0; j < i + 1; j++) - ((float *)wdata[i].p)[j] = (float)(i * 10 + ((float)j) / 10.0); + ((float *)wdata[i].p)[j] = (float)(i * 10 + ((float)j) / 10.0F); } /* write out the floats in little-endian format */ @@ -2716,7 +2716,7 @@ static void gent_vldatatypes3(void) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { wdata[i].i=i*10; - wdata[i].f=(float)((i*20)/3.0); + wdata[i].f=(float)((i*20)/3.0F); wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int)); wdata[i].v.len=i+1; for(j=0; j<(i+1); j++) @@ -2788,7 +2788,7 @@ static void gent_vldatatypes4(void) wdata[i].len=i+1; for(j=0; j<(i+1); j++) { ((s1 *)wdata[i].p)[j].i=i*10+j; - ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0); + ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F); } /* end for */ } /* end for */ @@ -3159,7 +3159,7 @@ static void gent_array4(void) for(i=0; i<SPACE1_DIM1; i++) for(j=0; j<ARRAY1_DIM1; j++) { wdata[i][j].i=i*10+j; - wdata[i][j].f=(float)(i*2.5+j); + wdata[i][j].f=(float)(i*2.5F+j); } /* end for */ /* Create file */ @@ -3227,7 +3227,7 @@ static void gent_array5(void) for(j=0; j<ARRAY1_DIM1; j++) { wdata[i][j].i=i*10+j; for(k=0; k<ARRAY1_DIM1; k++) - wdata[i][j].f[k]=(float)(i*10+j*2.5+k); + wdata[i][j].f[k]=(float)(i*10+j*2.5F+k); } /* end for */ /* Create file */ @@ -4933,10 +4933,10 @@ static void gent_compound_complex(void) } } - Array1[m].e = (float)( m * .96 ); + Array1[m].e = (float)( m * 0.96F ); for(n = 0; n < F41_ARRAY_DIMf; n++) { - Array1[m].f[n] = ( m * 1024.9637 ); + Array1[m].f[n] = ( m * 1024.9637F ); } Array1[m].g = 'm'; @@ -6873,7 +6873,7 @@ gent_fpformat(void) { hid_t fid, sid, did; hsize_t dims[1] = {6}; - double dbuf[6] = {-0.1234567, 0.1234567, 0, 0, 0, 0}; + double dbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0}; float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0}; fid = H5Fcreate(FILE60, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -7193,7 +7193,7 @@ gent_packedbits(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * j + i; + dsetdbl[i][j] = 0.0001F * j + i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); @@ -7383,7 +7383,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * j + i; + dsetdbl[i][j] = 0.0001F * j + i; H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl); @@ -7591,7 +7591,7 @@ static void gent_compound_intsizes(void) { for(n = 0; n < dims[0]; n++) for(o = 0; o < dims[1]; o++) - Array1[m].dsetdbl[n][o] = 0.0001 * o + n; + Array1[m].dsetdbl[n][o] = 0.0001F * o + n; } /* Create the array data type for the 8 bits signed int array */ @@ -7866,7 +7866,7 @@ static void gent_compound_attr_intsizes(void) { for(n = 0; n < dims[0]; n++) for(o = 0; o < dims[1]; o++) - Array1[m].dsetdbl[n][o] = 0.0001 * o + n; + Array1[m].dsetdbl[n][o] = 0.0001F * o + n; } /* Create the array data type for the 8 bits signed int array */ @@ -8034,17 +8034,17 @@ static void gent_nested_compound_dt(void) { /* test nested data type */ dset1[i].b = (float)(i*i); dset2[i].a = i; - dset2[i].b = (float)(i+i*0.1); + dset2[i].b = (float)(i+i*0.1F); dset2[i].c = GREEN; for(j = 0; j < 5; j++) { dset3[i].a[j] = i*j; for(k = 0; k < 6; k++) { - dset3[i].b[j][k] = (float)(i*j*k*1.0); + dset3[i].b[j][k] = (float)(i*j*k*1.0F); } } dset3[i].c.a = i; - dset3[i].c.b = (float)(i*1.0); + dset3[i].c.b = (float)(i*1.0F); } fid = H5Fcreate(FILE72, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -8332,7 +8332,7 @@ gent_intscalars(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * j + i; + dsetdbl[i][j] = 0.0001F * j + i; H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); @@ -8531,7 +8531,7 @@ gent_attr_intscalars(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * j + i; + dsetdbl[i][j] = 0.0001F * j + i; H5Awrite(attr, tid, dsetdbl); @@ -8717,7 +8717,7 @@ static void gent_compound_int_array(void) { dims[0] = F76_DIM8; for(n = 0; n < dims[0]; n++) - Cmpd1[m].dsetdbl[n] = 0.0001 + n; + Cmpd1[m].dsetdbl[n] = 0.0001F + n; } /* Create the array data type for the 8 bits signed int array */ @@ -8948,8 +8948,8 @@ static void gent_compound_ints(void) { val64bits <<= 1; /* Double Dummy set for failure tests */ - Cmpd1[m].dsetdbl = 0.0001 + m; - Cmpd2[m].dsetdbl = 0.0001 + m; + Cmpd1[m].dsetdbl = 0.0001F + m; + Cmpd2[m].dsetdbl = 0.0001F + m; } /* Create the dataspace */ @@ -9286,7 +9286,7 @@ gent_intattrscalars(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * j + i; + dsetdbl[i][j] = 0.0001F * j + i; H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); /* Attribute of double */ @@ -9551,7 +9551,7 @@ gent_intsattrs(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) { - dsetdbl[i][j] = 0.0001 * j + i; + dsetdbl[i][j] = 0.0001F * j + i; asetdbl[i*dims[1]+j] = dsetdbl[i][j]; } diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index 49f977c..ac839fb 100644 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -40,13 +40,13 @@ main(void) FILE *sp; float row4[3], col4[4], pln4[5]; - float rowo4 = (float)11.0e0, colo4 = (float)21.0e0, plno4 = (float)51.0e0; - float rowi4 = (float)1.0e0, coli4 = (float)2.0e0, plni4 = (float)5.0e0; + float rowo4 = 11.0F, colo4 = 21.0F, plno4 = 51.0F; + float rowi4 = 1.0F, coli4 = 2.0F, plni4 = 5.0F; int b32i3[5][3][4]; int row4i[3], col4i[4], pln4i[5]; - int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ; - int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ; + int rowo4i = 11 , colo4i = 21 , plno4i = 51 ; + int rowi4i = 1 , coli4i = 2 , plni4i = 5 ; #ifdef H5_SIZEOF_LONG_LONG long long row4i64[3], col4i64[4], pln4i64[5]; @@ -66,8 +66,8 @@ main(void) double b64r3[5][3][4]; double row8[3], col8[4], pln8[5]; - double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; - double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; + double rowo8 = 11.0F, colo8 = 21.0F, plno8 = 51.0F; + double rowi8 = 1.0F, coli8 = 2.0F, plni8 = 5.0F; /* diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index 9636597..5a93c13 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -254,7 +254,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) space = H5Screate_simple(1, dims, NULL); dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for (i = 0; i < 10; i++) - dset2_1[i] = (float)(i*0.1+1); + dset2_1[i] = (float)(i*0.1F+1); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); H5Sclose(space); H5Dclose(dataset); @@ -265,7 +265,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for (i = 0; i < 3; i++) for (j = 0; j < 5; j++) - dset2_2[i][j] = (float)((i+1)*j*0.1); + dset2_2[i][j] = (float)((i+1)*j*0.1F); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2); H5Sclose(space); H5Dclose(dataset); diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index 78e7fe9..b8d44de 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -40,7 +40,7 @@ * The number to divide the tv_usec field with to get a nice decimal to add to * the number of seconds. */ -#define MICROSECOND 1000000.0 +#define MICROSECOND 1000000.0F /* global variables */ io_time_t *timer_g; /* timer: global for stub functions */ diff --git a/tools/perform/chunk.c b/tools/perform/chunk.c index a3c11c1..6825a4c 100644 --- a/tools/perform/chunk.c +++ b/tools/perform/chunk.c @@ -57,20 +57,20 @@ #define RM_CACHE_STRT 25 #define RM_CACHE_END 25 #define RM_CACHE_DELT 5 -#define RM_START 0.50 -#define RM_END 5.00 -#define RM_DELTA 0.50 -#define RM_W0 0.0 +#define RM_START 0.50F +#define RM_END 5.00F +#define RM_DELTA 0.50F +#define RM_W0 0.0F #define RM_NRDCC 521 /* Diagonal test */ #define DIAG_CACHE_STRT 25 #define DIAG_CACHE_END 25 #define DIAG_CACHE_DELT 5 -#define DIAG_START 0.50 -#define DIAG_END 5.00 -#define DIAG_DELTA 0.50 -/* #define DIAG_W0 0.65 */ +#define DIAG_START 0.50F +#define DIAG_END 5.00F +#define DIAG_DELTA 0.50F +/* #define DIAG_W0 0.65F */ /* #define DIAG_NRDCC 521 */ static size_t nio_g; diff --git a/tools/perform/iopipe.c b/tools/perform/iopipe.c index 85063fa..a04ef82 100644 --- a/tools/perform/iopipe.c +++ b/tools/perform/iopipe.c @@ -81,25 +81,25 @@ print_stats (const char *prefix, double u_time, s_time; u_time = ((double)(r_stop->ru_utime.tv_sec)+ - (double)(r_stop->ru_utime.tv_usec)/1000000.0) - + (double)(r_stop->ru_utime.tv_usec)/1000000.0F) - ((double)(r_start->ru_utime.tv_sec)+ - (double)(r_start->ru_utime.tv_usec)/1000000.0); + (double)(r_start->ru_utime.tv_usec)/1000000.0F); s_time = ((double)(r_stop->ru_stime.tv_sec)+ - (double)(r_stop->ru_stime.tv_usec)/1000000.0) - + (double)(r_stop->ru_stime.tv_usec)/1000000.0F) - ((double)(r_start->ru_stime.tv_sec)+ - (double)(r_start->ru_stime.tv_usec)/1000000.0); + (double)(r_start->ru_stime.tv_usec)/1000000.0F); #endif #ifndef H5_HAVE_SYS_TIMEB e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000000.0) - + (double)(t_stop->tv_usec)/1000000.0F) - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000000.0); + (double)(t_start->tv_usec)/1000000.0F); #else e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000.0) - + (double)(t_stop->tv_usec)/1000.0F) - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000.0); + (double)(t_start->tv_usec)/1000.0F); #endif bw = (double)nbytes / e_time; @@ -191,7 +191,7 @@ main (void) * 1998-11-06 ptl */ printf ("I/O request size is %1.1fMB\n", - (double)(hssize_t)(size[0]*size[1])/1024.0*1024); + (double)(hssize_t)(size[0]*size[1])/1024.0F*1024); /* Open the files */ file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/perform/overhead.c b/tools/perform/overhead.c index 9341e64..046668f 100644 --- a/tools/perform/overhead.c +++ b/tools/perform/overhead.c @@ -209,7 +209,7 @@ test(fill_t fill_style, const double splits[], if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; if(!use_rdcc) { if(H5Pget_cache(fapl, &mdc_nelmts, NULL, NULL, NULL) < 0) goto error; - if(H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0) < 0) goto error; + if(H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0F) < 0) goto error; } if((file = H5Fcreate(FILE_NAME_1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; diff --git a/tools/perform/sio_perf.c b/tools/perform/sio_perf.c index 1828d6f..7d75a2d 100644 --- a/tools/perform/sio_perf.c +++ b/tools/perform/sio_perf.c @@ -68,7 +68,7 @@ #define SIO_HDF5 0x4 /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes,t) (((t)==0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) +#define MB_PER_SEC(bytes,t) (((t)==0.0F) ? 0.0F : ((((double)bytes) / ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 @@ -451,14 +451,14 @@ run_test(iotype iot, parameters parms, struct options *opts) minmax *read_mm_table=NULL; minmax *read_gross_mm_table=NULL; minmax *read_raw_mm_table=NULL; - minmax write_sys_mm = {0.0, 0.0, 0.0, 0}; - minmax write_mm = {0.0, 0.0, 0.0, 0}; - minmax write_gross_mm = {0.0, 0.0, 0.0, 0}; - minmax write_raw_mm = {0.0, 0.0, 0.0, 0}; - minmax read_sys_mm = {0.0, 0.0, 0.0, 0}; - minmax read_mm = {0.0, 0.0, 0.0, 0}; - minmax read_gross_mm = {0.0, 0.0, 0.0, 0}; - minmax read_raw_mm = {0.0, 0.0, 0.0, 0}; + minmax write_sys_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax write_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax write_gross_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax write_raw_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax read_sys_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax read_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax read_gross_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax read_raw_mm = {0.0F, 0.0F, 0.0F, 0}; raw_size = (off_t)parms.num_bytes; parms.io_type = iot; @@ -717,7 +717,7 @@ accumulate_minmax_stuff(minmax *mm, int count) int i; minmax total_mm; - total_mm.sum = 0.0; + total_mm.sum = 0.0F; total_mm.max = -DBL_MAX; total_mm.min = DBL_MAX; total_mm.num = count; diff --git a/tools/perform/zip_perf.c b/tools/perform/zip_perf.c index edd5b0f..f73ba40 100644 --- a/tools/perform/zip_perf.c +++ b/tools/perform/zip_perf.c @@ -43,10 +43,10 @@ #define ONE_MB (ONE_KB * ONE_KB) #define ONE_GB (ONE_MB * ONE_KB) -#define MICROSECOND 1000000.0 +#define MICROSECOND 1000000.0F /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes,t) ((fabs(t)<0.0000000001) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) +#define MB_PER_SEC(bytes,t) ((fabs(t)<0.0000000001F) ? 0.0F : ((((double)bytes) / ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 @@ -182,7 +182,7 @@ write_file(Bytef *source, uLongf sourceLen) /* destination buffer needs to be at least 0.1% larger than sourceLen * plus 12 bytes */ - destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1)) + 12; + destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1F)) + 12; dest = (Bytef *)HDmalloc(destLen); if (!dest) @@ -464,7 +464,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, error("out of memory"); } - compression_time = 0.0; + compression_time = 0.0F; if (random_test) fill_with_random_data(src, src_len); |