diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-09-14 17:54:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 17:54:00 (GMT) |
commit | aa849f07e323e4654ac22dbcd2221d9c8d357486 (patch) | |
tree | f7a9f4ec99cbd92ea8d7fb2f57e1838cc71bdd7f /test | |
parent | ffa4bdac0a686aa00705b72132c5e8948cfee9db (diff) | |
download | hdf5-aa849f07e323e4654ac22dbcd2221d9c8d357486.zip hdf5-aa849f07e323e4654ac22dbcd2221d9c8d357486.tar.gz hdf5-aa849f07e323e4654ac22dbcd2221d9c8d357486.tar.bz2 |
Remove HD prefix from math functions (#3538)
Diffstat (limited to 'test')
-rw-r--r-- | test/direct_chunk.c | 2 | ||||
-rw-r--r-- | test/dsets.c | 50 | ||||
-rw-r--r-- | test/dt_arith.c | 36 | ||||
-rw-r--r-- | test/mtime.c | 2 | ||||
-rw-r--r-- | test/swmr.c | 2 |
5 files changed, 46 insertions, 46 deletions
diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 7c79b26..e9756a9 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 6d33845..52cc452 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 @@ out: 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 dd25b9d..0980150 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 4dc5957..252eebf 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 6b9e097..f448d16 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 */ |