Fix for failing h5diff tests involving floating-point compares.
This commit is contained in:
committed by
David Young
parent
0479a345cc
commit
23f103cf6b
@@ -4559,11 +4559,15 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (H5_DBL_ABS_EQUAL(value, expected))
|
||||
/* Are the bits the same? */
|
||||
if (!HDmemcmp(&value, &expected, sizeof(double)))
|
||||
return TRUE;
|
||||
|
||||
/* Check for equality within appropriate floating-point
|
||||
* tolerance, if requested.
|
||||
*/
|
||||
if (opts->use_system_epsilon)
|
||||
if (ABS((value-expected)) < DBL_EPSILON)
|
||||
if (H5_DBL_ABS_EQUAL(value, expected))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@@ -4603,11 +4607,15 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (H5_LDBL_ABS_EQUAL(value, expected))
|
||||
/* Are the bits the same? */
|
||||
if (!HDmemcmp(&value, &expected, sizeof(long double)))
|
||||
return TRUE;
|
||||
|
||||
/* Check for equality within appropriate floating-point
|
||||
* tolerance, if requested.
|
||||
*/
|
||||
if (opts->use_system_epsilon)
|
||||
if (ABS((value-expected)) < DBL_EPSILON)
|
||||
if (H5_LDBL_ABS_EQUAL(value, expected))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@@ -4645,11 +4653,15 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (H5_FLT_ABS_EQUAL(value, expected))
|
||||
/* Are the bits the same? */
|
||||
if (!HDmemcmp(&value, &expected, sizeof(float)))
|
||||
return TRUE;
|
||||
|
||||
/* Check for equality within appropriate floating-point
|
||||
* tolerance, if requested.
|
||||
*/
|
||||
if (opts->use_system_epsilon)
|
||||
if (ABS( (value-expected) ) < FLT_EPSILON)
|
||||
if (H5_FLT_ABS_EQUAL(value, expected))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user