diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-05-07 16:45:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 16:45:05 (GMT) |
commit | 9023e98940d959aa974e655cc383fab0b0ed663c (patch) | |
tree | 8cad5bb35e1385c7a267319f4baf688d0efade63 /tools | |
parent | 1e572b18e3c271f9de045a6b61e3c855779e7c58 (diff) | |
download | hdf5-9023e98940d959aa974e655cc383fab0b0ed663c.zip hdf5-9023e98940d959aa974e655cc383fab0b0ed663c.tar.gz hdf5-9023e98940d959aa974e655cc383fab0b0ed663c.tar.bz2 |
Removes gratuitous (double)x.yF casts (#632)
* Committing clang-format changes
* Removes gratuitous (double)x.yF casts
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/src/h5diff/h5diff_common.c | 2 | ||||
-rw-r--r-- | tools/src/h5ls/h5ls.c | 2 | ||||
-rw-r--r-- | tools/src/h5stat/h5stat.c | 4 | ||||
-rw-r--r-- | tools/test/h5import/h5importtest.c | 4 | ||||
-rw-r--r-- | tools/test/perform/chunk.c | 16 | ||||
-rw-r--r-- | tools/test/perform/chunk_cache.c | 30 | ||||
-rw-r--r-- | tools/test/perform/iopipe.c | 11 | ||||
-rw-r--r-- | tools/test/perform/sio_perf.c | 3 | ||||
-rw-r--r-- | tools/test/perform/zip_perf.c | 11 |
9 files changed, 41 insertions, 42 deletions
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 603b1f3..1b81824 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -375,7 +375,7 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char opts->percent = HDatof(opt_arg); /* -p 0 is the same as default */ - if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F)) + if (H5_DBL_ABS_EQUAL(opts->percent, 0.0)) opts->percent_bool = 0; break; diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index a0b9441..4392d85 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1983,7 +1983,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) HSIZE_T_FORMAT " logical byte%s, " HSIZE_T_FORMAT " allocated byte%s", total, 1 == total ? "" : "s", used, 1 == used ? "" : "s"); if (used > 0) { - utilization = ((double)total * (double)100.0f) / (double)used; + utilization = ((double)total * 100.0) / (double)used; h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization); } } diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 3e7a8c1..e091a8a 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -1609,7 +1609,7 @@ print_storage_summary(const iter_t *iter) { hsize_t total_meta = 0; hsize_t unaccount = 0; - double percent = 0.0f; + double percent = 0.0; HDfprintf(stdout, "File space management strategy: %s\n", FS_STRATEGY_NAME[iter->fs_strategy]); HDfprintf(stdout, "File space page size: %" PRIuHSIZE " bytes\n", iter->fsp_size); @@ -1624,7 +1624,7 @@ print_storage_summary(const iter_t *iter) HDfprintf(stdout, " File metadata: %" PRIuHSIZE " bytes\n", total_meta); HDfprintf(stdout, " Raw data: %" PRIuHSIZE " bytes\n", iter->dset_storage_size); - percent = ((double)iter->free_space / (double)iter->filesize) * (double)100.0f; + percent = ((double)iter->free_space / (double)iter->filesize) * 100.0; HDfprintf(stdout, " Amount/Percent of tracked free space: %" PRIuHSIZE " bytes/%3.1f%%\n", iter->free_space, percent); diff --git a/tools/test/h5import/h5importtest.c b/tools/test/h5import/h5importtest.c index 340e31b..e49125b 100644 --- a/tools/test/h5import/h5importtest.c +++ b/tools/test/h5import/h5importtest.c @@ -64,8 +64,8 @@ main(void) double b64r3[5][3][4]; double row8[3], col8[4], pln8[5]; - double rowo8 = 11.0F, colo8 = 21.0F, plno8 = 51.0F; - double rowi8 = 1.0F, coli8 = 2.0F, plni8 = 5.0F; + double rowo8 = 11.0, colo8 = 21.0, plno8 = 51.0; + double rowi8 = 1.0, coli8 = 2.0, plni8 = 5.0; /* Initialize machine endian */ volatile uint32_t ibyte = 0x01234567; diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index ada2ed3..1b6793a 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -55,20 +55,20 @@ #define RM_CACHE_STRT 25 #define RM_CACHE_END 25 #define RM_CACHE_DELT 5 -#define RM_START (double)0.50F -#define RM_END (double)5.00F -#define RM_DELTA (double)0.50F -#define RM_W0 0.0F +#define RM_START 0.50 +#define RM_END 5.00 +#define RM_DELTA 0.50 +#define RM_W0 0.0 #define RM_NRDCC 521 /* Diagonal test */ #define DIAG_CACHE_STRT 25 #define DIAG_CACHE_END 25 #define DIAG_CACHE_DELT 5 -#define DIAG_START (double)0.50F -#define DIAG_END (double)5.00F -#define DIAG_DELTA (double)0.50F -/* #define DIAG_W0 0.65F */ +#define DIAG_START 0.50 +#define DIAG_END 5.00 +#define DIAG_DELTA 0.50 +/* #define DIAG_W0 0.65 */ /* #define DIAG_NRDCC 521 */ static size_t nio_g; diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index fcaa337..25fa34c 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -262,13 +262,14 @@ check_partial_chunks_perf(hid_t file) end_t = H5_get_time(); - if ((end_t - start_t) > (double)0.0f) - printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n", - (end_t - start_t), nbytes_global); + if ((end_t - start_t) > 0.0) + HDprintf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n", + (end_t - start_t), nbytes_global); else - printf("1. Partial chunks: no total read time because timer is not available; number of bytes being " - "read from file is %zu\n", - nbytes_global); + HDprintf( + "1. Partial chunks: no total read time because timer is not available; number of bytes being " + "read from file is %zu\n", + nbytes_global); H5Dclose(dataset); H5Sclose(filespace); @@ -340,13 +341,14 @@ check_hash_value_perf(hid_t file) end_t = H5_get_time(); - if ((end_t - start_t) > (double)0.0f) - printf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n", - (end_t - start_t), nbytes_global); + if ((end_t - start_t) > 0.0) + HDprintf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n", + (end_t - start_t), nbytes_global); else - printf("2. Hash value: no total read time because timer is not available; number of bytes being read " - "from file is %zu\n", - nbytes_global); + HDprintf( + "2. Hash value: no total read time because timer is not available; number of bytes being read " + "from file is %zu\n", + nbytes_global); H5Dclose(dataset); H5Sclose(filespace); @@ -375,7 +377,7 @@ error: int main(void) { - hid_t file; /* handles */ + hid_t file = H5I_INVALID_HID; /* file ID */ int nerrors = 0; /* Create a new file. If file exists its contents will be overwritten. */ @@ -404,6 +406,6 @@ main(void) return 0; error: - fprintf(stderr, "*** ERRORS DETECTED ***\n"); + HDfprintf(stderr, "*** ERRORS DETECTED ***\n"); return 1; } diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index 68eaa3a..d0db06a 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -64,11 +64,11 @@ print_stats(const char *prefix, #ifdef H5_HAVE_GETRUSAGE double u_time, s_time; - u_time = ((double)(r_stop->ru_utime.tv_sec) + (double)(r_stop->ru_utime.tv_usec) / (double)1000000.0F) - - ((double)(r_start->ru_utime.tv_sec) + (double)(r_start->ru_utime.tv_usec) / (double)1000000.0F); + u_time = ((double)(r_stop->ru_utime.tv_sec) + (double)(r_stop->ru_utime.tv_usec) / 1000000.0) - + ((double)(r_start->ru_utime.tv_sec) + (double)(r_start->ru_utime.tv_usec) / 1000000.0); - s_time = ((double)(r_stop->ru_stime.tv_sec) + (double)(r_stop->ru_stime.tv_usec) / (double)1000000.0F) - - ((double)(r_start->ru_stime.tv_sec) + (double)(r_start->ru_stime.tv_usec) / (double)1000000.0F); + s_time = ((double)(r_stop->ru_stime.tv_sec) + (double)(r_stop->ru_stime.tv_usec) / 1000000.0) - + ((double)(r_start->ru_stime.tv_sec) + (double)(r_start->ru_stime.tv_usec) / 1000000.0); #endif e_time = t_stop - t_start; H5_bandwidth(bw, (double)nbytes, e_time); @@ -149,8 +149,7 @@ main(void) * Win32 version 5.0 compiler. * 1998-11-06 ptl */ - HDprintf("I/O request size is %1.1fMB\n", - (double)(hssize_t)(size[0] * size[1]) / (double)1024.0F * (double)1024); + HDprintf("I/O request size is %1.1fMB\n", (double)(hssize_t)(size[0] * size[1]) / 1024.0 * 1024.0); /* Open the files */ file = H5Fcreate(HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index 5b3a9e8..fe4e7e7 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -65,8 +65,7 @@ #define SIO_HDF5 0x4 /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes, t) \ - (H5_DBL_ABS_EQUAL(t, (double)0.0F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t))) +#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL(t, 0.0) ? 0.0 : ((((double)bytes) / (double)ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 6a1e1aa..517866b 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -32,11 +32,10 @@ #define ONE_MB (ONE_KB * ONE_KB) #define ONE_GB (ONE_MB * ONE_KB) -#define MICROSECOND 1000000.0F +#define MICROSECOND 1000000.0 /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes, t) \ - ((fabs(t) < (double)0.0000000001F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t))) +#define MB_PER_SEC(bytes, t) ((fabs(t) < 0.0000000001) ? 0.0 : ((((double)bytes) / (double)ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 @@ -169,7 +168,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 * (double)0.1F)) + 12; + destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1)) + 12; dest = (Bytef *)HDmalloc(destLen); if (!dest) @@ -179,8 +178,8 @@ write_file(Bytef *source, uLongf sourceLen) compress_buffer(dest, &destLen, source, sourceLen); HDgettimeofday(&timer_stop, NULL); - compression_time += ((double)timer_stop.tv_sec + ((double)timer_stop.tv_usec) / (double)MICROSECOND) - - ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / (double)MICROSECOND); + compression_time += ((double)timer_stop.tv_sec + ((double)timer_stop.tv_usec) / MICROSECOND) - + ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / MICROSECOND); if (report_once_flag) { HDfprintf(stdout, "\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen); |