From 1e8d03193b4fd8f586630c8be01a54a484e58cd8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 14 Sep 2023 01:08:12 -0700 Subject: [PATCH 1/2] Remove HD prefix from math functions --- src/H5Bcache.c | 2 +- src/H5FDonion.c | 2 +- src/H5FDsubfiling/H5FDioc.c | 2 +- src/H5FDsubfiling/H5subfiling_common.c | 4 +- src/H5Fint.c | 6 +- src/H5Tconv.c | 28 ++++---- src/H5VLnative_token.c | 2 +- src/H5Zdeflate.c | 2 +- src/H5Zscaleoffset.c | 12 ++-- src/H5private.h | 90 ++------------------------ src/H5system.c | 2 +- src/H5timer.c | 6 +- test/direct_chunk.c | 2 +- test/dsets.c | 50 +++++++------- test/dt_arith.c | 36 +++++------ test/mtime.c | 2 +- test/swmr.c | 2 +- tools/lib/h5diff_array.c | 48 +++++++------- tools/test/h5diff/h5diffgentest.c | 36 +++++------ 19 files changed, 128 insertions(+), 206 deletions(-) diff --git a/src/H5Bcache.c b/src/H5Bcache.c index bc693faef52..d9c94f498ce 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -289,7 +289,7 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, vo *image++ = (uint8_t)shared->type->id; /* 2^8 limit: only 1 byte is used to store node level */ - if (bt->level >= HDpow(2, LEVEL_BITS)) + if (bt->level >= pow(2, LEVEL_BITS)) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode node level"); H5_CHECK_OVERFLOW(bt->level, unsigned, uint8_t); diff --git a/src/H5FDonion.c b/src/H5FDonion.c index 189bd3ffa39..06db8df007e 100644 --- a/src/H5FDonion.c +++ b/src/H5FDonion.c @@ -995,7 +995,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "page size is not a power of two"); /* Assign the page size */ - log2_page_size = HDlog2((double)(fa->page_size)); + log2_page_size = log2((double)(fa->page_size)); file->curr_rev_record.archival_index.page_size_log2 = (uint32_t)log2_page_size; /* Proceed with open. */ diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 8a7169a68ca..c58a3d5fcbe 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -1531,7 +1531,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) "can't delete subfiling config file"); /* Try to delete each of the subfiles */ - num_digits = (int)(HDlog10(n_subfiles) + 1); + num_digits = (int)(log10(n_subfiles) + 1); for (int i = 0; i < n_subfiles; i++) { /* TODO: No support for subfile directory prefix currently */ diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index cca179de781..645701c2773 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -2181,7 +2181,7 @@ ioc_open_files(int64_t file_context_id, int file_acc_flags) "couldn't allocate space for subfile filename"); num_subfiles = sf_context->sf_num_subfiles; - num_digits = (int)(HDlog10(num_subfiles) + 1); + num_digits = (int)(log10(num_subfiles) + 1); /* * For each subfile this IOC rank owns, generate the name @@ -2364,7 +2364,7 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c "failed to write to subfiling configuration file"); /* Write out each subfile name to the configuration file */ - num_digits = (int)(HDlog10(n_subfiles) + 1); + num_digits = (int)(log10(n_subfiles) + 1); for (int k = 0; k < n_subfiles; k++) { HDsnprintf(line_buf, PATH_MAX, H5FD_SUBFILING_FILENAME_TEMPLATE "\n", base_filename, sf_context->h5_file_id, num_digits, k + 1, n_subfiles); diff --git a/src/H5Fint.c b/src/H5Fint.c index 607dbad5723..8029d352c63 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3307,7 +3307,7 @@ H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Index to retries based on log10 */ - tmp = HDlog10((double)retries); + tmp = log10((double)retries); log_ind = (unsigned)tmp; assert(log_ind < f->shared->retries_nbins); @@ -3345,9 +3345,9 @@ H5F_set_retries(H5F_t *f) /* Initialize the # of bins for retries */ f->shared->retries_nbins = 0; if (f->shared->read_attempts > 1) { - /* Use HDceil to ensure that the log10 value is rounded up to the + /* Use ceil to ensure that the log10 value is rounded up to the nearest integer before casting to unsigned */ - tmp = HDceil(HDlog10((double)f->shared->read_attempts)); + tmp = ceil(log10((double)f->shared->read_attempts)); f->shared->retries_nbins = (unsigned)tmp; } diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 016c3f4035c..4d848b6d122 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1718,7 +1718,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (src->shared->size >= dst->shared->size) { double olap_d = - HDceil((double)(dst->shared->size) / (double)(src->shared->size - dst->shared->size)); + ceil((double)(dst->shared->size) / (double)(src->shared->size - dst->shared->size)); olap = (size_t)olap_d; sp = dp = (uint8_t *)buf; @@ -1726,7 +1726,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else { double olap_d = - HDceil((double)(src->shared->size) / (double)(dst->shared->size - src->shared->size)); + ceil((double)(src->shared->size) / (double)(dst->shared->size - src->shared->size)); olap = (size_t)olap_d; sp = (uint8_t *)buf + (nelmts - 1) * src->shared->size; dp = (uint8_t *)buf + (nelmts - 1) * dst->shared->size; @@ -3871,7 +3871,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (src->shared->size >= dst->shared->size) { double olap_d = - HDceil((double)(dst->shared->size) / (double)(src->shared->size - dst->shared->size)); + ceil((double)(dst->shared->size) / (double)(src->shared->size - dst->shared->size)); olap = (size_t)olap_d; sp = dp = (uint8_t *)buf; @@ -3879,7 +3879,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else { double olap_d = - HDceil((double)(src->shared->size) / (double)(dst->shared->size - src->shared->size)); + ceil((double)(src->shared->size) / (double)(dst->shared->size - src->shared->size)); olap = (size_t)olap_d; sp = (uint8_t *)buf + (nelmts - 1) * src->shared->size; dp = (uint8_t *)buf + (nelmts - 1) * dst->shared->size; @@ -4329,14 +4329,14 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz olap = nelmts; } else if (src_p->shared->size >= dst_p->shared->size) { - double olap_d = HDceil((double)(dst_p->shared->size) / + double olap_d = ceil((double)(dst_p->shared->size) / (double)(src_p->shared->size - dst_p->shared->size)); olap = (size_t)olap_d; sp = dp = (uint8_t *)buf; direction = 1; } else { - double olap_d = HDceil((double)(src_p->shared->size) / + double olap_d = ceil((double)(src_p->shared->size) / (double)(dst_p->shared->size - src_p->shared->size)); olap = (size_t)olap_d; sp = (uint8_t *)buf + (nelmts - 1) * src_p->shared->size; @@ -4900,14 +4900,14 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (src->shared->size >= dst->shared->size) { double olapd = - HDceil((double)(dst->shared->size) / (double)(src->shared->size - dst->shared->size)); + ceil((double)(dst->shared->size) / (double)(src->shared->size - dst->shared->size)); olap = (size_t)olapd; sp = dp = (uint8_t *)buf; direction = 1; } else { double olapd = - HDceil((double)(src->shared->size) / (double)(dst->shared->size - src->shared->size)); + ceil((double)(src->shared->size) / (double)(dst->shared->size - src->shared->size)); olap = (size_t)olapd; sp = (uint8_t *)buf + (nelmts - 1) * src->shared->size; dp = (uint8_t *)buf + (nelmts - 1) * dst->shared->size; @@ -7958,14 +7958,14 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz olap = nelmts; } else if (src_p->shared->size >= dst_p->shared->size) { - double olap_d = HDceil((double)(dst_p->shared->size) / + double olap_d = ceil((double)(dst_p->shared->size) / (double)(src_p->shared->size - dst_p->shared->size)); olap = (size_t)olap_d; sp = dp = (uint8_t *)buf; direction = 1; } else { - double olap_d = HDceil((double)(src_p->shared->size) / + double olap_d = ceil((double)(src_p->shared->size) / (double)(dst_p->shared->size - src_p->shared->size)); olap = (size_t)olap_d; sp = (uint8_t *)buf + (nelmts - 1) * src_p->shared->size; @@ -7976,7 +7976,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Allocate enough space for the buffer holding temporary * converted value */ - buf_size = (size_t)(HDpow(2.0, (double)src.u.f.esize) / 8 + 1); + buf_size = (size_t)(pow(2.0, (double)src.u.f.esize) / 8 + 1); int_buf = (uint8_t *)H5MM_calloc(buf_size); /* Get conversion exception callback property */ @@ -8583,14 +8583,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz olap = nelmts; } else if (src_p->shared->size >= dst_p->shared->size) { - double olap_d = HDceil((double)(dst_p->shared->size) / + double olap_d = ceil((double)(dst_p->shared->size) / (double)(src_p->shared->size - dst_p->shared->size)); olap = (size_t)olap_d; sp = dp = (uint8_t *)buf; direction = 1; } else { - double olap_d = HDceil((double)(src_p->shared->size) / + double olap_d = ceil((double)(src_p->shared->size) / (double)(dst_p->shared->size - src_p->shared->size)); olap = (size_t)olap_d; sp = (uint8_t *)buf + (nelmts - 1) * src_p->shared->size; @@ -8811,7 +8811,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } /* Check if the exponent is too big */ - expo_max = (hsize_t)(HDpow(2.0, (double)dst.u.f.esize) - 1); + expo_max = (hsize_t)(pow(2.0, (double)dst.u.f.esize) - 1); if (expo > expo_max) { /*overflows*/ if (cb_struct.func) { /*user's exception handler. Reverse back source order*/ diff --git a/src/H5VLnative_token.c b/src/H5VLnative_token.c index e03299ebfc2..800858f758b 100644 --- a/src/H5VLnative_token.c +++ b/src/H5VLnative_token.c @@ -107,7 +107,7 @@ H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *tok if (addr == 0) addr_ndigits = 1; else - addr_ndigits = (size_t)(HDfloor(HDlog10((double)addr)) + 1); + addr_ndigits = (size_t)(floor(log10((double)addr)) + 1); if (NULL == (*token_str = H5MM_malloc(addr_ndigits + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for token string"); diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index b7a372b645a..032945ae0bf 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -42,7 +42,7 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{ H5Z__filter_deflate, /* The actual filter function */ }}; -#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12) +#define H5Z_DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s)) * 1.001) + 12) /*------------------------------------------------------------------------- * Function: H5Z__filter_deflate diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index bfcbbb0d5c9..a5a9ca6bea6 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -364,12 +364,12 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ #define H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ { \ i = 0; \ - while (i < d_nelmts && HDfabs((double)(buf[i] - filval)) < HDpow(10.0, -D_val)) \ + while (i < d_nelmts && fabs((double)(buf[i] - filval)) < pow(10.0, -D_val)) \ i++; \ if (i < d_nelmts) \ min = max = buf[i]; \ for (; i < d_nelmts; i++) { \ - if (HDfabs((double)(buf[i] - filval)) < HDpow(10.0, -D_val)) \ + if (fabs((double)(buf[i] - filval)) < pow(10.0, -D_val)) \ continue; /* ignore fill value */ \ if (buf[i] > max) \ max = buf[i]; \ @@ -1562,10 +1562,10 @@ H5Z__scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoff FUNC_ENTER_PACKAGE if (type == t_float) - H5Z_scaleoffset_precompress_3(float, HDpowf, HDfabsf, HDroundf, HDlroundf, HDllroundf, data, d_nelmts, + H5Z_scaleoffset_precompress_3(float, powf, fabsf, roundf, lroundf, llroundf, data, d_nelmts, filavail, cd_values, minbits, minval, D_val); else if (type == t_double) - H5Z_scaleoffset_precompress_3(double, HDpow, HDfabs, HDround, HDlround, HDllround, data, d_nelmts, + H5Z_scaleoffset_precompress_3(double, pow, fabs, round, lround, llround, data, d_nelmts, filavail, cd_values, minbits, minval, D_val); done: @@ -1585,10 +1585,10 @@ H5Z__scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scale FUNC_ENTER_PACKAGE if (type == t_float) - H5Z_scaleoffset_postdecompress_3(float, HDpowf, data, d_nelmts, filavail, cd_values, minbits, sminval, + H5Z_scaleoffset_postdecompress_3(float, powf, data, d_nelmts, filavail, cd_values, minbits, sminval, D_val); else if (type == t_double) - H5Z_scaleoffset_postdecompress_3(double, HDpow, data, d_nelmts, filavail, cd_values, minbits, sminval, + H5Z_scaleoffset_postdecompress_3(double, pow, data, d_nelmts, filavail, cd_values, minbits, sminval, D_val); done: diff --git a/src/H5private.h b/src/H5private.h index 8157c8ab247..b2604a96b98 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -454,13 +454,13 @@ * 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_ABS_EQUAL(X, Y) (fabsf((X) - (Y)) < FLT_EPSILON) +#define H5_DBL_ABS_EQUAL(X, Y) (fabs((X) - (Y)) < DBL_EPSILON) +#define H5_LDBL_ABS_EQUAL(X, Y) (fabsl((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)) +#define H5_FLT_REL_EQUAL(X, Y, M) (fabsf(((Y) - (X)) / (X)) < (M)) +#define H5_DBL_REL_EQUAL(X, Y, M) (fabs(((Y) - (X)) / (X)) < (M)) +#define H5_LDBL_REL_EQUAL(X, Y, M) (fabsl(((Y) - (X)) / (X)) < (M)) /* KiB, MiB, GiB, TiB, PiB, EiB - Used in profiling and timing code */ #define H5_KB (1024.0F) @@ -617,9 +617,6 @@ typedef off_t h5_stat_size_t; #ifndef HDasctime #define HDasctime(T) asctime(T) #endif -#ifndef HDceil -#define HDceil(X) ceil(X) -#endif #ifndef HDchdir #define HDchdir(S) chdir(S) #endif @@ -641,15 +638,6 @@ typedef off_t h5_stat_size_t; #ifndef HDdifftime #define HDdifftime(X, Y) difftime(X, Y) #endif -#ifndef HDfabs -#define HDfabs(X) fabs(X) -#endif -#ifndef HDfabsf -#define HDfabsf(X) fabsf(X) -#endif -#ifndef HDfabsl -#define HDfabsl(X) fabsl(X) -#endif #ifndef HDfdopen #define HDfdopen(N, S) fdopen(N, S) #endif @@ -688,24 +676,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #endif /* HDflock */ -#ifndef HDfloor -#define HDfloor(X) floor(X) -#endif #ifndef HDfputc #define HDfputc(C, F) fputc(C, F) #endif #ifndef HDfputs #define HDfputs(S, F) fputs(S, F) #endif -#ifndef HDfrexp -#define HDfrexp(X, N) frexp(X, N) -#endif -#ifndef HDfrexpf -#define HDfrexpf(X, N) frexpf(X, N) -#endif -#ifndef HDfrexpl -#define HDfrexpl(X, N) frexpl(X, N) -#endif #ifndef HDfscanf #define HDfscanf fscanf #endif @@ -757,45 +733,9 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDisatty #define HDisatty(F) isatty(F) #endif -#ifndef HDisnan -#define HDisnan(X) isnan(X) -#endif -#ifndef HDlabs -#define HDlabs(X) labs(X) -#endif -#ifndef HDldexp -#define HDldexp(X, N) ldexp(X, N) -#endif -#ifndef HDllround -#define HDllround(V) llround(V) -#endif -#ifndef HDllroundf -#define HDllroundf(V) llroundf(V) -#endif -#ifndef HDllroundl -#define HDllroundl(V) llroundl(V) -#endif #ifndef HDlocaltime #define HDlocaltime(T) localtime(T) #endif -#ifndef HDlog -#define HDlog(X) log(X) -#endif -#ifndef HDlog2 -#define HDlog2(X) log2(X) -#endif -#ifndef HDlog10 -#define HDlog10(X) log10(X) -#endif -#ifndef HDlround -#define HDlround(V) lround(V) -#endif -#ifndef HDlroundf -#define HDlroundf(V) lroundf(V) -#endif -#ifndef HDlroundl -#define HDlroundl(V) lroundl(V) -#endif #ifndef HDlseek #define HDlseek(F, O, W) lseek(F, O, W) #endif @@ -820,12 +760,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDperror #define HDperror(S) perror(S) #endif -#ifndef HDpow -#define HDpow(X, Y) pow(X, Y) -#endif -#ifndef HDpowf -#define HDpowf(X, Y) powf(X, Y) -#endif #ifndef HDpread #define HDpread(F, B, C, O) pread(F, B, C, O) #endif @@ -899,15 +833,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDrewind #define HDrewind(F) rewind(F) #endif -#ifndef HDround -#define HDround(V) round(V) -#endif -#ifndef HDroundf -#define HDroundf(V) roundf(V) -#endif -#ifndef HDroundl -#define HDroundl(V) roundl(V) -#endif #ifndef HDrmdir #define HDrmdir(S) rmdir(S) #endif @@ -944,9 +869,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDsprintf #define HDsprintf sprintf /*varargs*/ #endif -#ifndef HDsqrt -#define HDsqrt(X) sqrt(X) -#endif #ifndef HDsscanf #define HDsscanf sscanf /*varargs*/ #endif diff --git a/src/H5system.c b/src/H5system.c index 9e44e28e328..3ece99a7355 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -803,7 +803,7 @@ H5_nanosleep(uint64_t nanosec) FUNC_ENTER_NOAPI_NOINIT_NOERR #ifdef H5_HAVE_WIN32_API - DWORD dwMilliseconds = (DWORD)HDceil(nanosec / 1.0e6); + DWORD dwMilliseconds = (DWORD)ceil(nanosec / 1.0e6); DWORD ignore; /* Windows can't sleep at a ns resolution. Best we can do is ~1 ms. We diff --git a/src/H5timer.c b/src/H5timer.c index c1adf438944..dcb3dbce7fa 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -568,15 +568,15 @@ H5_timer_get_time_string(double seconds) remainder_sec = seconds; /* Extract days */ - days = HDfloor(remainder_sec / H5_SEC_PER_DAY); + days = floor(remainder_sec / H5_SEC_PER_DAY); remainder_sec -= (days * H5_SEC_PER_DAY); /* Extract hours */ - hours = HDfloor(remainder_sec / H5_SEC_PER_HOUR); + hours = floor(remainder_sec / H5_SEC_PER_HOUR); remainder_sec -= (hours * H5_SEC_PER_HOUR); /* Extract minutes */ - minutes = HDfloor(remainder_sec / H5_SEC_PER_MIN); + minutes = floor(remainder_sec / H5_SEC_PER_MIN); remainder_sec -= (minutes * H5_SEC_PER_MIN); /* The # of seconds left is in remainder_sec */ diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 605eb2cd382..2de05573533 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -47,7 +47,7 @@ #define CHUNK_NY 4 #ifdef H5_HAVE_FILTER_DEFLATE -#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12.0) +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s)) * 1.001) + 12.0) #endif /* Temporary filter IDs used for testing */ diff --git a/test/dsets.c b/test/dsets.c index 6d33845d7a4..52cc4523dc4 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -3234,7 +3234,7 @@ test_nbit_int(hid_t file) /* Initialize data, assuming size of long long >= size of int */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0, (double)(precision - 1)); + power = pow(2.0, (double)(precision - 1)); orig_data[i][j] = (int)(((long long)HDrandom() % (long long)power) << offset); /* even-numbered values are negative */ @@ -3388,7 +3388,7 @@ test_nbit_float(hid_t file) */ for (i = 0; i < (size_t)size[0]; i++) { for (j = 0; j < (size_t)size[1]; j++) { - if (HDisnan(orig_data[i][j])) + if (isnan(orig_data[i][j])) continue; /* skip if value is NaN */ if (!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { H5_FAILED(); @@ -3510,7 +3510,7 @@ test_nbit_double(hid_t file) */ for (i = 0; i < (size_t)size[0]; i++) { for (j = 0; j < (size_t)size[1]; j++) { - if (HDisnan(orig_data[i][j])) + if (isnan(orig_data[i][j])) continue; /* skip if value is NaN */ if (!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { H5_FAILED(); @@ -3611,7 +3611,7 @@ test_nbit_array(hid_t file) for (j = 0; j < (size_t)size[1]; j++) for (m = 0; m < (size_t)adims[0]; m++) for (n = 0; n < (size_t)adims[1]; n++) { - power = HDpow(2.0, (double)precision); + power = pow(2.0, (double)precision); orig_data[i][j][m][n] = (unsigned int)(((long long)HDrandom() % (long long)power) << offset); } /* end for */ @@ -3804,11 +3804,11 @@ test_nbit_compound(hid_t file) /* Initialize data, assuming size of long long >= size of member datatypes */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0, (double)(precision[0] - 1)); + power = pow(2.0, (double)(precision[0] - 1)); orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); - power = HDpow(2.0, (double)(precision[1] - 1)); + power = pow(2.0, (double)(precision[1] - 1)); orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0, (double)(precision[2] - 1)); + power = pow(2.0, (double)(precision[2] - 1)); orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); orig_data[i][j].f = float_val[i][j]; @@ -3853,7 +3853,7 @@ test_nbit_compound(hid_t file) if (((unsigned)new_data[i][j].i & i_mask) != ((unsigned)orig_data[i][j].i & i_mask) || ((unsigned)new_data[i][j].c & c_mask) != ((unsigned)orig_data[i][j].c & c_mask) || ((unsigned)new_data[i][j].s & s_mask) != ((unsigned)orig_data[i][j].s & s_mask) || - (!HDisnan(orig_data[i][j].f) && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f))) { + (!isnan(orig_data[i][j].f) && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f))) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -4083,32 +4083,32 @@ test_nbit_compound_2(hid_t file) /* Initialize data, assuming size of long long >= size of member datatypes */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0, (double)(precision[0] - 1)); + power = pow(2.0, (double)(precision[0] - 1)); orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); - power = HDpow(2.0, (double)(precision[1] - 1)); + power = pow(2.0, (double)(precision[1] - 1)); orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0, (double)(precision[2] - 1)); + power = pow(2.0, (double)(precision[2] - 1)); orig_data[i][j].a.s = (short)(-(((long long)HDrandom() % (long long)power) << offset[2])); orig_data[i][j].a.f = float_val[i][j]; - power = HDpow(2.0, (double)precision[3]); + power = pow(2.0, (double)precision[3]); orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]); for (m = 0; m < (size_t)array_dims[0]; m++) for (n = 0; n < (size_t)array_dims[1]; n++) { - power = HDpow(2.0, (double)(precision[4] - 1)); + power = pow(2.0, (double)(precision[4] - 1)); orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]); } /* end for */ for (m = 0; m < (size_t)array_dims[0]; m++) for (n = 0; n < (size_t)array_dims[1]; n++) { - power = HDpow(2.0, (double)(precision[0] - 1)); + power = pow(2.0, (double)(precision[0] - 1)); orig_data[i][j].d[m][n].i = (int)(-(((long long)HDrandom() % (long long)power) << offset[0])); - power = HDpow(2.0, (double)(precision[1] - 1)); + power = pow(2.0, (double)(precision[1] - 1)); orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0, (double)(precision[2] - 1)); + power = pow(2.0, (double)(precision[2] - 1)); orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); orig_data[i][j].d[m][n].f = float_val[i][j]; @@ -4177,7 +4177,7 @@ test_nbit_compound_2(hid_t file) ((unsigned)orig_data[i][j].d[m][n].c & c_mask) || ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask) || - (!HDisnan(new_data[i][j].d[m][n].f) && + (!isnan(new_data[i][j].d[m][n].f) && !H5_FLT_ABS_EQUAL(new_data[i][j].d[m][n].f, new_data[i][j].d[m][n].f))) { d_failed = 1; goto out; @@ -4187,7 +4187,7 @@ test_nbit_compound_2(hid_t file) if (((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask) || ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask) || ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask) || - (!HDisnan(new_data[i][j].a.f) && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) || + (!isnan(new_data[i][j].a.f) && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) || new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -4336,7 +4336,7 @@ test_nbit_compound_3(hid_t file) /* Initialize data */ for (i = 0; i < (size_t)size[0]; i++) { - power = HDpow(2.0, 17.0 - 1.0); + power = pow(2.0, 17.0 - 1.0); memset(&orig_data[i], 0, sizeof(orig_data[i])); orig_data[i].i = (int)(HDrandom() % (long)power); HDstrcpy(orig_data[i].str, "fixed-length C string"); @@ -4522,7 +4522,7 @@ test_nbit_int_size(hid_t file) */ for (i = 0; i < DSET_DIM1; i++) for (j = 0; j < DSET_DIM2; j++) { - power = HDpow(2.0, (double)(precision - 1)); + power = pow(2.0, (double)(precision - 1)); orig[i][j] = HDrandom() % (int)power << offset; } @@ -5174,7 +5174,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((double)(new_data[i][j] - orig_data[i][j])) > HDpow(10.0, -3.0)) { + if (fabs((double)(new_data[i][j] - orig_data[i][j])) > pow(10.0, -3.0)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -5317,7 +5317,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((double)(new_data[0][j] - orig_data[0][j])) > HDpow(10.0, -3.0)) { + if (fabs((double)(new_data[0][j] - orig_data[0][j])) > pow(10.0, -3.0)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -5435,7 +5435,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 (fabs(new_data[i][j] - orig_data[i][j]) > pow(10.0, -7.0)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -5578,7 +5578,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((double)(new_data[0][j] - orig_data[0][j])) > HDpow(10.0, -7.0)) { + if (fabs((double)(new_data[0][j] - orig_data[0][j])) > pow(10.0, -7.0)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -7742,7 +7742,7 @@ gcd(long l0, long r0) { long magnitude, remainder; bool negative = ((l0 < 0) != (r0 < 0)); - long l = HDlabs(l0), r = HDlabs(r0); + long l = labs(l0), r = labs(r0); do { if (l < r) { diff --git a/test/dt_arith.c b/test/dt_arith.c index dd25b9dd388..0980150dffa 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -3014,8 +3014,8 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) if (FLT_FLOAT == dst_type) { hw_f = (float)(*((double *)aligned)); hw = (unsigned char *)&hw_f; - underflow = HDfabs(*((double *)aligned)) < (double)FLT_MIN; - overflow = HDfabs(*((double *)aligned)) > (double)FLT_MAX; + underflow = fabs(*((double *)aligned)) < (double)FLT_MIN; + overflow = fabs(*((double *)aligned)) > (double)FLT_MAX; } else if (FLT_DOUBLE == dst_type) { hw_d = *((double *)aligned); @@ -3034,14 +3034,14 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) if (FLT_FLOAT == dst_type) { hw_f = (float)*((long double *)aligned); hw = (unsigned char *)&hw_f; - underflow = HDfabsl(*((long double *)aligned)) < (long double)FLT_MIN; - overflow = HDfabsl(*((long double *)aligned)) > (long double)FLT_MAX; + underflow = fabsl(*((long double *)aligned)) < (long double)FLT_MIN; + overflow = fabsl(*((long double *)aligned)) > (long double)FLT_MAX; } else if (FLT_DOUBLE == dst_type) { hw_d = (double)*((long double *)aligned); hw = (unsigned char *)&hw_d; - underflow = HDfabsl(*((long double *)aligned)) < (long double)DBL_MIN; - overflow = HDfabsl(*((long double *)aligned)) > (long double)DBL_MAX; + underflow = fabsl(*((long double *)aligned)) < (long double)DBL_MIN; + overflow = fabsl(*((long double *)aligned)) > (long double)DBL_MAX; } else { hw_ld = *((long double *)aligned); @@ -3120,32 +3120,32 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) if (FLT_FLOAT == dst_type) { float x = 0.0; memcpy(&x, &buf[j * dst_size], sizeof(float)); - if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) + if (underflow && fabsf(x) <= FLT_MIN && fabsf(hw_f) <= FLT_MIN) continue; /* all underflowed, no error */ if (overflow && my_isinf(dendian, buf + j * sizeof(float), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) continue; /* all overflowed, no error */ - check_mant[0] = (double)HDfrexpf(x, check_expo + 0); - check_mant[1] = (double)HDfrexpf(hw_f, check_expo + 1); + check_mant[0] = (double)frexpf(x, check_expo + 0); + check_mant[1] = (double)frexpf(hw_f, check_expo + 1); } else if (FLT_DOUBLE == dst_type) { double x = 0.0; memcpy(&x, &buf[j * dst_size], sizeof(double)); - if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) + if (underflow && fabs(x) <= DBL_MIN && fabs(hw_d) <= DBL_MIN) continue; /* all underflowed, no error */ if (overflow && my_isinf(dendian, buf + j * sizeof(double), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) continue; /* all overflowed, no error */ - check_mant[0] = HDfrexp(x, check_expo + 0); - check_mant[1] = HDfrexp(hw_d, check_expo + 1); + check_mant[0] = frexp(x, check_expo + 0); + check_mant[1] = frexp(hw_d, check_expo + 1); #if (H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE) } else { long double x = 0.0L; memcpy(&x, &buf[j * dst_size], sizeof(long double)); /* dst is largest float, no need to check underflow. */ - check_mant[0] = (double)HDfrexpl(x, check_expo + 0); - check_mant[1] = (double)HDfrexpl(hw_ld, check_expo + 1); + check_mant[0] = (double)frexpl(x, check_expo + 0); + check_mant[1] = (double)frexpl(hw_ld, check_expo + 1); #endif } /* Special check for denormalized values */ @@ -3157,18 +3157,18 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) /* Re-scale the mantissas based on any exponent difference */ if (expo_diff != 0) - check_mant[0] = HDldexp(check_mant[0], expo_diff); + check_mant[0] = ldexp(check_mant[0], expo_diff); /* Compute the proper epsilon */ - epsilon = HDldexp(epsilon, -valid_bits); + epsilon = ldexp(epsilon, -valid_bits); /* Check for "close enough" fit with scaled epsilon value */ - if (HDfabs(check_mant[0] - check_mant[1]) <= epsilon) + if (fabs(check_mant[0] - check_mant[1]) <= epsilon) continue; } /* end if */ else { if (check_expo[0] == check_expo[1] && - HDfabs(check_mant[0] - check_mant[1]) < (double)FP_EPSILON) + fabs(check_mant[0] - check_mant[1]) < (double)FP_EPSILON) continue; } /* end else */ } diff --git a/test/mtime.c b/test/mtime.c index 4dc5957d9fd..252eebf156e 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -110,7 +110,7 @@ main(void) HDputs(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; } - else if (HDfabs(HDdifftime(now, oi1.ctime)) > 60.0) { + else if (fabs(HDdifftime(now, oi1.ctime)) > 60.0) { H5_FAILED(); tm = HDlocaltime(&(oi1.ctime)); HDstrftime((char *)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); diff --git a/test/swmr.c b/test/swmr.c index 6b9e097e361..f448d16fe49 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -3241,7 +3241,7 @@ tssw_persist_dapl_verify(hid_t did, hid_t vdsid1, hid_t vdsid2, hsize_t boundary TEST_ERROR; if (rdcc_nbytes != rdcc_nbytes_out) TEST_ERROR; - if (HDfabs(rdcc_w0 - rdcc_w0_out) > (double)FP_EPSILON) + if (fabs(rdcc_w0 - rdcc_w0_out) > (double)FP_EPSILON) TEST_ERROR; /* Get efile prefix property and verify */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index c0430bc24ae..dd7698336e1 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -1688,8 +1688,8 @@ diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d *------------------------------------------------------------------------- */ if (opts->do_nans) { - isnan1 = HDisnan(temp1_float); - isnan2 = HDisnan(temp2_float); + isnan1 = isnan(temp1_float); + isnan2 = isnan(temp2_float); } /* both not NaN, do the comparison */ @@ -1725,8 +1725,8 @@ diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d *------------------------------------------------------------------------- */ if (opts->do_nans) { - isnan1 = HDisnan(temp1_float); - isnan2 = HDisnan(temp2_float); + isnan1 = isnan(temp1_float); + isnan2 = isnan(temp2_float); } /* both not NaN, do the comparison */ if ((!isnan1 && !isnan2)) { @@ -1773,8 +1773,8 @@ diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d *------------------------------------------------------------------------- */ if (opts->do_nans) { - isnan1 = HDisnan(temp1_float); - isnan2 = HDisnan(temp2_float); + isnan1 = isnan(temp1_float); + isnan2 = isnan(temp2_float); } /* both not NaN, do the comparison */ @@ -1866,8 +1866,8 @@ diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, *------------------------------------------------------------------------- */ if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); + isnan1 = isnan(temp1_double); + isnan2 = isnan(temp2_double); } /* both not NaN, do the comparison */ @@ -1902,8 +1902,8 @@ diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, *------------------------------------------------------------------------- */ if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); + isnan1 = isnan(temp1_double); + isnan2 = isnan(temp2_double); } /* both not NaN, do the comparison */ if (!isnan1 && !isnan2) { @@ -1948,8 +1948,8 @@ diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, *------------------------------------------------------------------------- */ if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); + isnan1 = isnan(temp1_double); + isnan2 = isnan(temp2_double); } /* both not NaN, do the comparison */ @@ -2041,8 +2041,8 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, *------------------------------------------------------------------------- */ if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); + isnan1 = isnan(temp1_double); + isnan2 = isnan(temp2_double); } /* both not NaN, do the comparison */ @@ -2076,8 +2076,8 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, *------------------------------------------------------------------------- */ if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); + isnan1 = isnan(temp1_double); + isnan2 = isnan(temp2_double); } /* both not NaN, do the comparison */ @@ -2123,8 +2123,8 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, *------------------------------------------------------------------------- */ if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); + isnan1 = isnan(temp1_double); + isnan2 = isnan(temp2_double); } /* both not NaN, do the comparison */ @@ -3140,8 +3140,8 @@ equal_double(double value, double expected, diff_opt_t *opts) * detect NaNs *------------------------------------------------------------------------- */ - bool isnan1 = HDisnan(value); - bool isnan2 = HDisnan(expected); + bool isnan1 = isnan(value); + bool isnan2 = isnan(expected); /*------------------------------------------------------------------------- * we consider NaN == NaN to be true @@ -3187,8 +3187,8 @@ equal_ldouble(long double value, long double expected, diff_opt_t *opts) * detect NaNs *------------------------------------------------------------------------- */ - bool isnan1 = HDisnan(value); - bool isnan2 = HDisnan(expected); + bool isnan1 = isnan(value); + bool isnan2 = isnan(expected); /*------------------------------------------------------------------------- * we consider NaN == NaN to be true @@ -3233,8 +3233,8 @@ equal_float(float value, float expected, diff_opt_t *opts) * detect NaNs *------------------------------------------------------------------------- */ - bool isnan1 = HDisnan(value); - bool isnan2 = HDisnan(expected); + bool isnan1 = isnan(value); + bool isnan2 = isnan(expected); /*------------------------------------------------------------------------- * we consider NaN == NaN to be true diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 37c2cc3797a..06bd2a9655e 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -1139,15 +1139,15 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) float data15[6]; float data16[6]; - data15[0] = (float)HDsqrt(-1.0); + data15[0] = (float)sqrt(-1.0); data15[1] = 1.0; - data15[2] = (float)HDsqrt(-1.0); + data15[2] = (float)sqrt(-1.0); data15[3] = 1.0; data15[4] = 1.0; data15[5] = 1.0; - data16[0] = (float)HDsqrt(-1.0); - data16[1] = (float)HDsqrt(-1.0); + data16[0] = (float)sqrt(-1.0); + data16[1] = (float)sqrt(-1.0); data16[2] = 1.0; data16[3] = 1.0; data16[4] = 1.0; @@ -1166,15 +1166,15 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) double data17[6]; double data18[6]; - data17[0] = HDsqrt(-1.0); + data17[0] = sqrt(-1.0); data17[1] = 1.0; - data17[2] = HDsqrt(-1.0); + data17[2] = sqrt(-1.0); data17[3] = 1.0; data17[4] = 1.0; data17[5] = 1.0; - data18[0] = HDsqrt(-1.0); - data18[1] = HDsqrt(-10000.0); + data18[0] = sqrt(-1.0); + data18[1] = sqrt(-10000.0); data18[2] = 1.0; data18[3] = 1.0; data18[4] = 1.0; @@ -1193,11 +1193,11 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) float data19[6]; double data20[6]; - data19[0] = data19[1] = data19[2] = (float)HDlog(0.0); - data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0); + data19[0] = data19[1] = data19[2] = (float)log(0.0); + data19[3] = data19[4] = data19[5] = (float)-log(0.0); - data20[0] = data20[1] = data20[2] = HDlog(0.0); - data20[3] = data20[4] = data20[5] = -HDlog(0.0); + data20[0] = data20[1] = data20[2] = log(0.0); + data20[3] = data20[4] = data20[5] = -log(0.0); write_dset(gid1, 1, dims1, "fp19", H5T_NATIVE_FLOAT, data19); write_dset(gid1, 1, dims1, "fp19_COPY", H5T_NATIVE_FLOAT, data19); @@ -1221,13 +1221,13 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) size_t type_size; hid_t tid; - buf1[0].d = HDsqrt(-1.0); - buf1[0].f = (float)HDsqrt(-1.0); - buf2[0].d = HDsqrt(-1.0); - buf2[0].f = (float)HDsqrt(-1.0); + buf1[0].d = sqrt(-1.0); + buf1[0].f = (float)sqrt(-1.0); + buf2[0].d = sqrt(-1.0); + buf2[0].f = (float)sqrt(-1.0); - buf1[1].d = HDsqrt(-1.0); - buf1[1].f = (float)HDsqrt(-1.0); + buf1[1].d = sqrt(-1.0); + buf1[1].f = (float)sqrt(-1.0); buf2[1].d = 0.0; buf2[1].f = 0.0; From 0729a5821e8d2305eea4b3826c9a50e78232476d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 14 Sep 2023 01:09:20 -0700 Subject: [PATCH 2/2] Format source --- src/H5Tconv.c | 54 ++++++++++++++++++++++---------------------- src/H5Zscaleoffset.c | 12 +++++----- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 4d848b6d122..e73e15528c2 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -4329,19 +4329,19 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz olap = nelmts; } else if (src_p->shared->size >= dst_p->shared->size) { - double olap_d = ceil((double)(dst_p->shared->size) / - (double)(src_p->shared->size - dst_p->shared->size)); - olap = (size_t)olap_d; + double olap_d = + ceil((double)(dst_p->shared->size) / (double)(src_p->shared->size - dst_p->shared->size)); + olap = (size_t)olap_d; sp = dp = (uint8_t *)buf; direction = 1; } else { - double olap_d = ceil((double)(src_p->shared->size) / - (double)(dst_p->shared->size - src_p->shared->size)); - olap = (size_t)olap_d; - sp = (uint8_t *)buf + (nelmts - 1) * src_p->shared->size; - dp = (uint8_t *)buf + (nelmts - 1) * dst_p->shared->size; - direction = -1; + double olap_d = + ceil((double)(src_p->shared->size) / (double)(dst_p->shared->size - src_p->shared->size)); + olap = (size_t)olap_d; + sp = (uint8_t *)buf + (nelmts - 1) * src_p->shared->size; + dp = (uint8_t *)buf + (nelmts - 1) * dst_p->shared->size; + direction = -1; } /* @@ -7958,19 +7958,19 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz olap = nelmts; } else if (src_p->shared->size >= dst_p->shared->size) { - double olap_d = ceil((double)(dst_p->shared->size) / - (double)(src_p->shared->size - dst_p->shared->size)); - olap = (size_t)olap_d; + double olap_d = + ceil((double)(dst_p->shared->size) / (double)(src_p->shared->size - dst_p->shared->size)); + olap = (size_t)olap_d; sp = dp = (uint8_t *)buf; direction = 1; } else { - double olap_d = ceil((double)(src_p->shared->size) / - (double)(dst_p->shared->size - src_p->shared->size)); - olap = (size_t)olap_d; - sp = (uint8_t *)buf + (nelmts - 1) * src_p->shared->size; - dp = (uint8_t *)buf + (nelmts - 1) * dst_p->shared->size; - direction = -1; + double olap_d = + ceil((double)(src_p->shared->size) / (double)(dst_p->shared->size - src_p->shared->size)); + olap = (size_t)olap_d; + sp = (uint8_t *)buf + (nelmts - 1) * src_p->shared->size; + dp = (uint8_t *)buf + (nelmts - 1) * dst_p->shared->size; + direction = -1; } /* Allocate enough space for the buffer holding temporary @@ -8583,19 +8583,19 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz olap = nelmts; } else if (src_p->shared->size >= dst_p->shared->size) { - double olap_d = ceil((double)(dst_p->shared->size) / - (double)(src_p->shared->size - dst_p->shared->size)); - olap = (size_t)olap_d; + double olap_d = + ceil((double)(dst_p->shared->size) / (double)(src_p->shared->size - dst_p->shared->size)); + olap = (size_t)olap_d; sp = dp = (uint8_t *)buf; direction = 1; } else { - double olap_d = ceil((double)(src_p->shared->size) / - (double)(dst_p->shared->size - src_p->shared->size)); - olap = (size_t)olap_d; - sp = (uint8_t *)buf + (nelmts - 1) * src_p->shared->size; - dp = (uint8_t *)buf + (nelmts - 1) * dst_p->shared->size; - direction = -1; + double olap_d = + ceil((double)(src_p->shared->size) / (double)(dst_p->shared->size - src_p->shared->size)); + olap = (size_t)olap_d; + sp = (uint8_t *)buf + (nelmts - 1) * src_p->shared->size; + dp = (uint8_t *)buf + (nelmts - 1) * dst_p->shared->size; + direction = -1; } /* Allocate enough space for the buffer holding temporary diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index a5a9ca6bea6..685e25a9c73 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -364,12 +364,12 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ #define H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ { \ i = 0; \ - while (i < d_nelmts && fabs((double)(buf[i] - filval)) < pow(10.0, -D_val)) \ + while (i < d_nelmts && fabs((double)(buf[i] - filval)) < pow(10.0, -D_val)) \ i++; \ if (i < d_nelmts) \ min = max = buf[i]; \ for (; i < d_nelmts; i++) { \ - if (fabs((double)(buf[i] - filval)) < pow(10.0, -D_val)) \ + if (fabs((double)(buf[i] - filval)) < pow(10.0, -D_val)) \ continue; /* ignore fill value */ \ if (buf[i] > max) \ max = buf[i]; \ @@ -1562,11 +1562,11 @@ H5Z__scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoff FUNC_ENTER_PACKAGE if (type == t_float) - H5Z_scaleoffset_precompress_3(float, powf, fabsf, roundf, lroundf, llroundf, data, d_nelmts, - filavail, cd_values, minbits, minval, D_val); + H5Z_scaleoffset_precompress_3(float, powf, fabsf, roundf, lroundf, llroundf, data, d_nelmts, filavail, + cd_values, minbits, minval, D_val); else if (type == t_double) - H5Z_scaleoffset_precompress_3(double, pow, fabs, round, lround, llround, data, d_nelmts, - filavail, cd_values, minbits, minval, D_val); + H5Z_scaleoffset_precompress_3(double, pow, fabs, round, lround, llround, data, d_nelmts, filavail, + cd_values, minbits, minval, D_val); done: FUNC_LEAVE_NOAPI(ret_value)