summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2009-01-13 16:33:31 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2009-01-13 16:33:31 (GMT)
commit108699a7a8e3fd459cf29ac1dea9a9623de9a561 (patch)
tree14c3d606767b364664c3d5ee1abe5e06614a0edd
parent050ded21d307de35b0394614aa0962e8bca2f850 (diff)
downloadhdf5-108699a7a8e3fd459cf29ac1dea9a9623de9a561.zip
hdf5-108699a7a8e3fd459cf29ac1dea9a9623de9a561.tar.gz
hdf5-108699a7a8e3fd459cf29ac1dea9a9623de9a561.tar.bz2
[svn-r16300] Added an option to avoid dealing with NaNs
-N, --nan Avoid NaNs detection Note: there is no shell script run for datasets with NaN because the output is non portable (different results and NaN strings for different systems) Tested: windows, linux
-rw-r--r--tools/h5diff/h5diff_common.c11
-rw-r--r--tools/h5diff/testfiles/h5diff_10.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_600.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_603.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_604.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_605.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_606.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_612.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_613.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_614.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_615.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_621.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_622.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_623.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_624.txt1
-rw-r--r--tools/lib/h5diff.h1
-rw-r--r--tools/lib/h5diff_array.c206
17 files changed, 136 insertions, 96 deletions
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index 5a59215..8a49fa0 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -31,7 +31,7 @@ const char *progname = "h5diff";
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVrvqn:d:p:";
+static const char *s_opts = "hVrvqn:d:p:N";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -41,6 +41,7 @@ static struct long_options l_opts[] = {
{ "count", require_arg, 'n' },
{ "delta", require_arg, 'd' },
{ "relative", require_arg, 'p' },
+ { "nan", no_arg, 'N' },
{ NULL, 0, '\0' }
};
@@ -70,6 +71,9 @@ void parse_command_line(int argc,
/* assume equal contents initially */
options->contents = 1;
+ /* NaNs are handled by default */
+ options->do_nans = 1;
+
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
{
@@ -130,6 +134,10 @@ void parse_command_line(int argc,
options->count = atol( opt_arg );
break;
+
+ case 'N':
+ options->do_nans = 0;
+ break;
}
}
@@ -323,6 +331,7 @@ void usage(void)
printf(" -r, --report Report mode. Print differences\n");
printf(" -v, --verbose Verbose mode. Print differences, list of objects\n");
printf(" -q, --quiet Quiet mode. Do not do output\n");
+ printf(" -N, --nan Avoid NaNs detection\n");
printf(" -n C, --count=C Print differences up to C number\n");
printf(" -d D, --delta=D Print difference when greater than limit D\n");
diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt
index a74a37c..5480df1 100644
--- a/tools/h5diff/testfiles/h5diff_10.txt
+++ b/tools/h5diff/testfiles/h5diff_10.txt
@@ -9,6 +9,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt
index dcf14f7..22a3155 100644
--- a/tools/h5diff/testfiles/h5diff_600.txt
+++ b/tools/h5diff/testfiles/h5diff_600.txt
@@ -9,6 +9,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt
index e274d88..80ee102 100644
--- a/tools/h5diff/testfiles/h5diff_603.txt
+++ b/tools/h5diff/testfiles/h5diff_603.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_604.txt b/tools/h5diff/testfiles/h5diff_604.txt
index 8232c38..acb12b9 100644
--- a/tools/h5diff/testfiles/h5diff_604.txt
+++ b/tools/h5diff/testfiles/h5diff_604.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_605.txt b/tools/h5diff/testfiles/h5diff_605.txt
index bce2118..94f016d 100644
--- a/tools/h5diff/testfiles/h5diff_605.txt
+++ b/tools/h5diff/testfiles/h5diff_605.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt
index 9a0a8cd..f181030 100644
--- a/tools/h5diff/testfiles/h5diff_606.txt
+++ b/tools/h5diff/testfiles/h5diff_606.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt
index 16baa7c..840058d 100644
--- a/tools/h5diff/testfiles/h5diff_612.txt
+++ b/tools/h5diff/testfiles/h5diff_612.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_613.txt b/tools/h5diff/testfiles/h5diff_613.txt
index e57c320..5c18686 100644
--- a/tools/h5diff/testfiles/h5diff_613.txt
+++ b/tools/h5diff/testfiles/h5diff_613.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_614.txt b/tools/h5diff/testfiles/h5diff_614.txt
index 828d250..a630e02 100644
--- a/tools/h5diff/testfiles/h5diff_614.txt
+++ b/tools/h5diff/testfiles/h5diff_614.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt
index 654a743..8fdc0ce 100644
--- a/tools/h5diff/testfiles/h5diff_615.txt
+++ b/tools/h5diff/testfiles/h5diff_615.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt
index 18acda6..746977e 100644
--- a/tools/h5diff/testfiles/h5diff_621.txt
+++ b/tools/h5diff/testfiles/h5diff_621.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt
index 7740b0a..4ead1fb 100644
--- a/tools/h5diff/testfiles/h5diff_622.txt
+++ b/tools/h5diff/testfiles/h5diff_622.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt
index e238a6b..fb94e0d 100644
--- a/tools/h5diff/testfiles/h5diff_623.txt
+++ b/tools/h5diff/testfiles/h5diff_623.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt
index 7100555..bb4b133 100644
--- a/tools/h5diff/testfiles/h5diff_624.txt
+++ b/tools/h5diff/testfiles/h5diff_624.txt
@@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index c013ba5..57d06a5 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -38,6 +38,7 @@ typedef struct {
int cmn_objs; /* do we have comparable objects */
int not_cmp; /* are the objects comparable */
int contents; /* equal contents */
+ int do_nans; /* consider Nans while diffing floats */
} diff_opt_t;
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 5d187cd..e5f065c 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -141,10 +141,10 @@ static hbool_t all_zero(const void *_mem, size_t size);
static int ull2float(unsigned long_long ull_value, float *f_value);
static hsize_t character_compare(unsigned char *mem1,unsigned char *mem2,hsize_t i,unsigned u,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph);
static hsize_t character_compare_opt(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph);
-static hbool_t equal_float(float value, float expected);
-static hbool_t equal_double(double value, double expected);
+static hbool_t equal_float(float value, float expected, diff_opt_t *options);
+static hbool_t equal_double(double value, double expected, diff_opt_t *options);
#if H5_SIZEOF_LONG_DOUBLE !=0
-static hbool_t equal_ldouble(long double value, long double expected);
+static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options);
#endif
static int print_data(diff_opt_t *options);
static void print_pos(int *ph,int pp,hsize_t curr_pos,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 );
@@ -1970,7 +1970,7 @@ hsize_t diff_datum(void *_mem1,
* no -d and -p
*-------------------------------------------------------------------------
*/
- else if (equal_float(temp1_float,temp2_float)==FALSE)
+ else if (equal_float(temp1_float,temp2_float,options)==FALSE)
{
if ( print_data(options) )
@@ -2139,7 +2139,7 @@ hsize_t diff_datum(void *_mem1,
* no -d and -p
*-------------------------------------------------------------------------
*/
- else if (equal_double(temp1_double,temp2_double)==FALSE)
+ else if (equal_double(temp1_double,temp2_double,options)==FALSE)
{
if ( print_data(options) )
{
@@ -2310,7 +2310,7 @@ hsize_t diff_datum(void *_mem1,
* no -d and -p
*-------------------------------------------------------------------------
*/
- else if (equal_ldouble(temp1_double,temp2_double)==FALSE)
+ else if (equal_ldouble(temp1_double,temp2_double,options)==FALSE)
{
if ( print_data(options) )
{
@@ -2931,7 +2931,7 @@ hsize_t diff_float(unsigned char *mem1,
memcpy(&temp2_float, mem2, sizeof(float));
- if (equal_float(temp1_float,temp2_float)==FALSE)
+ if (equal_float(temp1_float,temp2_float,options)==FALSE)
{
if ( print_data(options) )
{
@@ -3114,7 +3114,7 @@ hsize_t diff_double(unsigned char *mem1,
memcpy(&temp1_double, mem1, sizeof(double));
memcpy(&temp2_double, mem2, sizeof(double));
- if (equal_double(temp1_double,temp2_double)==FALSE)
+ if (equal_double(temp1_double,temp2_double,options)==FALSE)
{
if ( print_data(options) )
{
@@ -3293,7 +3293,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
memcpy(&temp1_double, mem1, sizeof(long double));
memcpy(&temp2_double, mem2, sizeof(long double));
- if (equal_ldouble(temp1_double,temp2_double)==FALSE)
+ if (equal_ldouble(temp1_double,temp2_double,options)==FALSE)
{
if ( print_data(options) )
{
@@ -5183,48 +5183,53 @@ error:
*-------------------------------------------------------------------------
*/
static
-hbool_t equal_double(double value, double expected)
+hbool_t equal_double(double value, double expected, diff_opt_t *options)
{
int both_zero;
int is_zero;
-/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- int isnan1 = my_isnan(FLT_DOUBLE,&value);
- int isnan2 = my_isnan(FLT_DOUBLE,&expected);
-
- /*-------------------------------------------------------------------------
- * we consider NaN == NaN to be true
- *-------------------------------------------------------------------------
- */
- if ( isnan1 && isnan2 )
- {
- return TRUE;
- }
- /*-------------------------------------------------------------------------
- * one is a NaN, do not compare but assume difference
- *-------------------------------------------------------------------------
- */
- if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
+ if ( options->do_nans )
{
- return FALSE;
+
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ int isnan1 = my_isnan(FLT_DOUBLE,&value);
+ int isnan2 = my_isnan(FLT_DOUBLE,&expected);
+
+ /*-------------------------------------------------------------------------
+ * we consider NaN == NaN to be true
+ *-------------------------------------------------------------------------
+ */
+ if ( isnan1 && isnan2 )
+ {
+ return TRUE;
+ }
+
+ /*-------------------------------------------------------------------------
+ * one is a NaN, do not compare but assume difference
+ *-------------------------------------------------------------------------
+ */
+ if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
+ {
+ return FALSE;
+ }
+
+ /*-------------------------------------------------------------------------
+ * both are not NaNs, compare
+ *-------------------------------------------------------------------------
+ */
}
- /*-------------------------------------------------------------------------
- * both are not NaNs, compare
- *-------------------------------------------------------------------------
- */
-
BOTH_ZERO(value,expected)
if (both_zero)
return TRUE;
IS_ZERO(expected)
if (is_zero)
- return(equal_double(expected,value));
+ return(equal_double(expected,value,options));
if ( ABS( (value-expected) / expected) < H5DIFF_DBL_EPSILON)
return TRUE;
@@ -5244,48 +5249,54 @@ hbool_t equal_double(double value, double expected)
#if H5_SIZEOF_LONG_DOUBLE !=0
static
-hbool_t equal_ldouble(long double value, long double expected)
+hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options)
{
int both_zero;
int is_zero;
-/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- int isnan1 = my_isnan(FLT_LDOUBLE,&value);
- int isnan2 = my_isnan(FLT_LDOUBLE,&expected);
-
- /*-------------------------------------------------------------------------
- * we consider NaN == NaN to be true
- *-------------------------------------------------------------------------
- */
- if ( isnan1 && isnan2 )
- {
- return TRUE;
- }
-
- /*-------------------------------------------------------------------------
- * one is a NaN, do not compare but assume difference
- *-------------------------------------------------------------------------
- */
- if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
+
+ if ( options->do_nans )
{
- return FALSE;
+
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ int isnan1 = my_isnan(FLT_LDOUBLE,&value);
+ int isnan2 = my_isnan(FLT_LDOUBLE,&expected);
+
+ /*-------------------------------------------------------------------------
+ * we consider NaN == NaN to be true
+ *-------------------------------------------------------------------------
+ */
+ if ( isnan1 && isnan2 )
+ {
+ return TRUE;
+ }
+
+ /*-------------------------------------------------------------------------
+ * one is a NaN, do not compare but assume difference
+ *-------------------------------------------------------------------------
+ */
+ if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
+ {
+ return FALSE;
+ }
+
+ /*-------------------------------------------------------------------------
+ * both are not NaNs, compare
+ *-------------------------------------------------------------------------
+ */
+
}
- /*-------------------------------------------------------------------------
- * both are not NaNs, compare
- *-------------------------------------------------------------------------
- */
-
BOTH_ZERO(value,expected)
if (both_zero)
return TRUE;
IS_ZERO(expected)
if (is_zero)
- return(equal_ldouble(expected,value));
+ return(equal_ldouble(expected,value,options));
if ( ABS( (value-expected) / expected) < H5DIFF_DBL_EPSILON)
return TRUE;
@@ -5309,48 +5320,53 @@ hbool_t equal_ldouble(long double value, long double expected)
*-------------------------------------------------------------------------
*/
static
-hbool_t equal_float(float value, float expected)
+hbool_t equal_float(float value, float expected, diff_opt_t *options)
{
int both_zero;
int is_zero;
-/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- int isnan1 = my_isnan(FLT_FLOAT,&value);
- int isnan2 = my_isnan(FLT_FLOAT,&expected);
-
- /*-------------------------------------------------------------------------
- * we consider NaN == NaN to be true
- *-------------------------------------------------------------------------
- */
- if ( isnan1 && isnan2 )
+ if ( options->do_nans )
{
- return TRUE;
- }
-
- /*-------------------------------------------------------------------------
- * one is a NaN, do not compare but assume difference
- *-------------------------------------------------------------------------
- */
- if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
- {
- return FALSE;
+
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ int isnan1 = my_isnan(FLT_FLOAT,&value);
+ int isnan2 = my_isnan(FLT_FLOAT,&expected);
+
+ /*-------------------------------------------------------------------------
+ * we consider NaN == NaN to be true
+ *-------------------------------------------------------------------------
+ */
+ if ( isnan1 && isnan2 )
+ {
+ return TRUE;
+ }
+
+ /*-------------------------------------------------------------------------
+ * one is a NaN, do not compare but assume difference
+ *-------------------------------------------------------------------------
+ */
+ if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
+ {
+ return FALSE;
+ }
+
+ /*-------------------------------------------------------------------------
+ * both are not NaNs, compare
+ *-------------------------------------------------------------------------
+ */
+
}
- /*-------------------------------------------------------------------------
- * both are not NaNs, compare
- *-------------------------------------------------------------------------
- */
-
BOTH_ZERO(value,expected)
if (both_zero)
return TRUE;
IS_ZERO(expected)
if (is_zero)
- return(equal_float(expected,value));
+ return(equal_float(expected,value,options));
if ( ABS( (value-expected) / expected) < H5DIFF_FLT_EPSILON)
return TRUE;