[svn-r8370] Purpose:

Bug fix.

Description:
Not all machines (like Sun and AIX) support fabsl() and fabsf() used
in test/dtypes.c.  Changed the coding to use macro names HDfabsl and
HDfabsf.  Also set the two macros to use ABS for now so that they will
work for all machines. (need more portable fixes which would involve
configure.)

Platforms tested:
h5committested. (also tested in LANL QSC and Theta).
This commit is contained in:
Albert Cheng 2004-04-17 12:17:32 -05:00
parent 9e859565e4
commit e4d5623692
2 changed files with 8 additions and 5 deletions

View File

@ -579,6 +579,9 @@ H5_DLL void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds);
#endif /* __MWERKS __ */ #endif /* __MWERKS __ */
#define HDexp(X) exp(X) #define HDexp(X) exp(X)
#define HDfabs(X) fabs(X) #define HDfabs(X) fabs(X)
/* use ABS() because fabsf() fabsl() are not common yet. */
#define HDfabsf(X) ABS(X)
#define HDfabsl(X) ABS(X)
#define HDfclose(F) fclose(F) #define HDfclose(F) fclose(F)
/* fcntl() variable arguments */ /* fcntl() variable arguments */
#define HDfdopen(N,S) fdopen(N,S) #define HDfdopen(N,S) fdopen(N,S)

View File

@ -4984,7 +4984,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
if (FLT_FLOAT==dst_type) { if (FLT_FLOAT==dst_type) {
hw_f = (float)(*((double*)aligned)); hw_f = (float)(*((double*)aligned));
hw = (unsigned char*)&hw_f; hw = (unsigned char*)&hw_f;
underflow = fabs(*((double*)aligned)) < FLT_MIN; underflow = HDfabs(*((double*)aligned)) < FLT_MIN;
} else if (FLT_DOUBLE==dst_type) { } else if (FLT_DOUBLE==dst_type) {
hw_d = *((double*)aligned); hw_d = *((double*)aligned);
hw = (unsigned char*)&hw_d; hw = (unsigned char*)&hw_d;
@ -5000,11 +5000,11 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
if (FLT_FLOAT==dst_type) { if (FLT_FLOAT==dst_type) {
hw_f = *((long double*)aligned); hw_f = *((long double*)aligned);
hw = (unsigned char*)&hw_f; hw = (unsigned char*)&hw_f;
underflow = fabsl(*((long double*)aligned)) < FLT_MIN; underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN;
} else if (FLT_DOUBLE==dst_type) { } else if (FLT_DOUBLE==dst_type) {
hw_d = *((long double*)aligned); hw_d = *((long double*)aligned);
hw = (unsigned char*)&hw_d; hw = (unsigned char*)&hw_d;
underflow = fabsl(*((long double*)aligned)) < DBL_MIN; underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN;
} else { } else {
hw_ld = *((long double*)aligned); hw_ld = *((long double*)aligned);
hw = (unsigned char*)&hw_ld; hw = (unsigned char*)&hw_ld;
@ -5069,7 +5069,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
float x; float x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
if (underflow && if (underflow &&
fabsf(x) <= FLT_MIN && fabsf(hw_f) <= FLT_MIN) HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
continue; /* all underflowed, no error */ continue; /* all underflowed, no error */
check_mant[0] = HDfrexpf(x, check_expo+0); check_mant[0] = HDfrexpf(x, check_expo+0);
check_mant[1] = HDfrexpf(hw_f, check_expo+1); check_mant[1] = HDfrexpf(hw_f, check_expo+1);
@ -5077,7 +5077,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
double x; double x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
if (underflow && if (underflow &&
fabs(x) <= DBL_MIN && fabs(hw_d) <= DBL_MIN) HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
continue; /* all underflowed, no error */ continue; /* all underflowed, no error */
check_mant[0] = HDfrexp(x, check_expo+0); check_mant[0] = HDfrexp(x, check_expo+0);
check_mant[1] = HDfrexp(hw_d, check_expo+1); check_mant[1] = HDfrexp(hw_d, check_expo+1);