diff options
author | Jonathan Kim <jkm@hdfgroup.org> | 2011-03-31 21:43:46 (GMT) |
---|---|---|
committer | Jonathan Kim <jkm@hdfgroup.org> | 2011-03-31 21:43:46 (GMT) |
commit | 553e452ce4f49a81d41a06b8eb8072bd47d30c59 (patch) | |
tree | 18fc63ff0d098ee4cfee23628cff326560927a9c /tools | |
parent | d03182a94e4e40fd9a14be55d5701c14ae85ec38 (diff) | |
download | hdf5-553e452ce4f49a81d41a06b8eb8072bd47d30c59.zip hdf5-553e452ce4f49a81d41a06b8eb8072bd47d30c59.tar.gz hdf5-553e452ce4f49a81d41a06b8eb8072bd47d30c59.tar.bz2 |
[svn-r20384] Purpose:
Fixed Bug 2184 - GMQS: h5diff - incorrect calculation code for
--use-system-epsilon option
Description:
Merged from HDF5 1.8 branch r20369.
Fixed h5diff for --use-system-epsilon option: the calculation changed
from ( |a - b| / b ) to ( |a - b| ). This was decided for better
performance and was corrected only in HDF5 trunk, so 1.8 got updated.
Also comments for equal_XXX() function were updated correctly.
Also help page and RM got updated correctly.
Also add test cases for testing the differences w/wo the option.
Tested:
jam (linux32-LE), amani (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows (32-LE)
Diffstat (limited to 'tools')
24 files changed, 145 insertions, 125 deletions
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index 48ba8e6..97c3a3c 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -45,6 +45,8 @@ IF (BUILD_TESTING) h5diff_100.txt #h5diff_101.txt #h5diff_102.txt + #h5diff_103.txt + #h5diff_104.txt h5diff_11.txt h5diff_12.txt h5diff_13.txt @@ -260,6 +262,19 @@ IF (BUILD_TESTING) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102w.txt ${PROJECT_BINARY_DIR}/h5diff_102.txt ) + ADD_CUSTOM_COMMAND ( + TARGET h5diff + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_103w.txt ${PROJECT_BINARY_DIR}/h5diff_103.txt + ) + + ADD_CUSTOM_COMMAND ( + TARGET h5diff + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104w.txt ${PROJECT_BINARY_DIR}/h5diff_104.txt + ) ELSE (WIN32 AND NOT CYGWIN) ADD_CUSTOM_COMMAND ( TARGET h5diff @@ -274,6 +289,19 @@ IF (BUILD_TESTING) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102.txt ${PROJECT_BINARY_DIR}/h5diff_102.txt ) + ADD_CUSTOM_COMMAND ( + TARGET h5diff + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_103.txt ${PROJECT_BINARY_DIR}/h5diff_103.txt + ) + + ADD_CUSTOM_COMMAND ( + TARGET h5diff + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104.txt ${PROJECT_BINARY_DIR}/h5diff_104.txt + ) ENDIF (WIN32 AND NOT CYGWIN) ############################################################################## @@ -371,6 +399,10 @@ IF (BUILD_TESTING) h5diff_101.out.err h5diff_102.out h5diff_102.out.err + h5diff_103.out + h5diff_103.out.err + h5diff_104.out + h5diff_104.out.err h5diff_11.out h5diff_11.out.err h5diff_12.out @@ -935,6 +967,13 @@ ADD_H5_TEST (h5diff_101 1 -v ${FILE1} ${FILE1} g1/d1 g1/d2) ADD_H5_TEST (h5diff_102 1 -v ${FILE1} ${FILE1} g1/fp1 g1/fp2) +# with --use-system-epsilon for double value. expect less differences +ADD_H5_TEST (h5diff_103 1 -v --use-system-epsilon ${FILE1} ${FILE1} g1/d1 +g1/d2) + +# with --use-system-epsilon for float value. expect less differences +ADD_H5_TEST (h5diff_104 1 -v --use-system-epsilon ${FILE1} ${FILE1} g1/fp1 +g1/fp2) # not comparable -c flag ADD_H5_TEST (h5diff_200 0 ${FILE2} ${FILE2} g2/dset1 g2/dset2) diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index da420b0..e0af7f6 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -485,17 +485,11 @@ void usage(void) printf(" number.\n"); printf(" -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive\n"); printf(" number.\n"); - printf(" --use-system-epsilon Print difference if (|a-b| > EPSILON),\n"); - printf(" where EPSILON (FLT_EPSILON or FLT_EPSILON) is the\n"); - printf(" system epsilon value. \n"); - printf(" If the system epsilon is not defined, use the value\n"); - printf(" below:\n"); + printf(" --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is\n"); + printf(" a system epsilon value.\n"); + printf(" The system epsilon values are defined as below:\n"); printf(" FLT_EPSILON = 1.19209E-07 for float\n"); printf(" DBL_EPSILON = 2.22045E-16 for double\n"); - printf(" -d, -p, and --use-system-epsilon options are used for\n"); - printf(" comparing floating point values.\n"); - printf(" By default, strict equality is used. Use -p or -d to\n"); - printf(" set specific tolerance.\n"); printf(" --exclude-path \"path\" Exclude the specified path to an object when\n"); printf(" comparing files or groups. If a group is excluded,\n"); printf(" all member objects will also be excluded.\n"); diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index dcfe76a..66f1ce8 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -312,11 +312,16 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - /* epsilon = 0.00001 */ - float data11[3][2] ={{0.00000f,0.00001f},{0.00001f, 0.00000f},{0.00001f,0.00001f}}; - float data12[3][2] ={{0.00000f,0.00002f},{0.000009f,0.00001f},{0.00000f,0.00001f}}; - double data13[3][2] ={{0.000000000,0.000000001},{0.000000001, 0.000000000},{0.000000001,0.000000001}}; - double data14[3][2] ={{0.000000000,0.000000002},{0.0000000009,0.000000001},{0.000000000,0.000000001}}; + /* epsilon = 0.0000001 = 1e-7 + * system epsilon for float : FLT_EPSILON = 1.19209E-07 + */ + float data11[3][2] ={{0.000000f,0.0000001f},{0.0000001f, 0.00000022f},{0.0000001f,0.0000001f}}; + float data12[3][2] ={{0.000000f,0.0000002f},{0.0000003f,0.0000001f},{0.000000f,0.0000001f}}; + /* epsilon = 0.0000000000000001 = 1e-16 + * system epsilon for double : DBL_EPSILON = 2.22045E-16 + */ + double data13[3][2] ={{0.0000000000000000, 0.0000000000000001},{0.0000000000000001, 0.0000000000000000},{0.00000000000000033, 0.0000000000000001}}; + double data14[3][2] ={{0.0000000000000000, 0.0000000000000004},{0.0000000000000002, 0.0000000000000001},{0.0000000000000001, 0.00000000000000000}}; write_dset(gid1,2,dims2,"fp1",H5T_NATIVE_FLOAT,data11); write_dset(gid1,2,dims2,"fp2",H5T_NATIVE_FLOAT,data12); diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt index 0b354df..8d6fc82 100644 --- a/tools/h5diff/testfiles/h5diff_10.txt +++ b/tools/h5diff/testfiles/h5diff_10.txt @@ -60,17 +60,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_101.txt b/tools/h5diff/testfiles/h5diff_101.txt index 1d0f38d..f915439 100644 --- a/tools/h5diff/testfiles/h5diff_101.txt +++ b/tools/h5diff/testfiles/h5diff_101.txt @@ -2,9 +2,10 @@ dataset: </g1/d1> and </g1/d2> size: [3x2] [3x2] position d1 d2 difference ------------------------------------------------------------ -[ 0 1 ] 1e-09 2e-09 1e-09 -[ 1 0 ] 1e-09 9e-10 1e-10 -[ 1 1 ] 0 1e-09 1e-09 -[ 2 0 ] 1e-09 0 1e-09 -4 differences found +[ 0 1 ] 1e-16 4e-16 3e-16 +[ 1 0 ] 1e-16 2e-16 1e-16 +[ 1 1 ] 0 1e-16 1e-16 +[ 2 0 ] 3.3e-16 1e-16 2.3e-16 +[ 2 1 ] 1e-16 0 1e-16 +5 differences found EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_101w.txt b/tools/h5diff/testfiles/h5diff_101w.txt index 59176a2..d1f49da 100755 --- a/tools/h5diff/testfiles/h5diff_101w.txt +++ b/tools/h5diff/testfiles/h5diff_101w.txt @@ -2,9 +2,10 @@ dataset: </g1/d1> and </g1/d2> size: [3x2] [3x2]
position d1 d2 difference
------------------------------------------------------------
-[ 0 1 ] 1e-009 2e-009 1e-009
-[ 1 0 ] 1e-009 9e-010 1e-010
-[ 1 1 ] 0 1e-009 1e-009
-[ 2 0 ] 1e-009 0 1e-009
-4 differences found
+[ 0 1 ] 1e-016 4e-016 3e-016
+[ 1 0 ] 1e-016 2e-016 1e-016
+[ 1 1 ] 0 1e-016 1e-016
+[ 2 0 ] 3.3e-016 1e-016 2.3e-016
+[ 2 1 ] 1e-016 0 1e-016
+5 differences found
EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_102.txt b/tools/h5diff/testfiles/h5diff_102.txt index 30a2491..476067b 100644 --- a/tools/h5diff/testfiles/h5diff_102.txt +++ b/tools/h5diff/testfiles/h5diff_102.txt @@ -2,9 +2,9 @@ dataset: </g1/fp1> and </g1/fp2> size: [3x2] [3x2] position fp1 fp2 difference ------------------------------------------------------------ -[ 0 1 ] 1e-05 2e-05 1e-05 -[ 1 0 ] 1e-05 9e-06 9.99999e-07 -[ 1 1 ] 0 1e-05 1e-05 -[ 2 0 ] 1e-05 0 1e-05 +[ 0 1 ] 1e-07 2e-07 1e-07 +[ 1 0 ] 1e-07 3e-07 2e-07 +[ 1 1 ] 2.2e-07 1e-07 1.2e-07 +[ 2 0 ] 1e-07 0 1e-07 4 differences found EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_102w.txt b/tools/h5diff/testfiles/h5diff_102w.txt index 36a254e..dda3581 100755 --- a/tools/h5diff/testfiles/h5diff_102w.txt +++ b/tools/h5diff/testfiles/h5diff_102w.txt @@ -2,9 +2,9 @@ dataset: </g1/fp1> and </g1/fp2> size: [3x2] [3x2]
position fp1 fp2 difference
------------------------------------------------------------
-[ 0 1 ] 1e-005 2e-005 1e-005
-[ 1 0 ] 1e-005 9e-006 9.99999e-007
-[ 1 1 ] 0 1e-005 1e-005
-[ 2 0 ] 1e-005 0 1e-005
+[ 0 1 ] 1e-007 2e-007 1e-007
+[ 1 0 ] 1e-007 3e-007 2e-007
+[ 1 1 ] 2.2e-007 1e-007 1.2e-007
+[ 2 0 ] 1e-007 0 1e-007
4 differences found
EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_103.txt b/tools/h5diff/testfiles/h5diff_103.txt new file mode 100644 index 0000000..5700459 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_103.txt @@ -0,0 +1,8 @@ +dataset: </g1/d1> and </g1/d2> +size: [3x2] [3x2] +position d1 d2 difference +------------------------------------------------------------ +[ 0 1 ] 1e-16 4e-16 3e-16 +[ 2 0 ] 3.3e-16 1e-16 2.3e-16 +2 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_103w.txt b/tools/h5diff/testfiles/h5diff_103w.txt new file mode 100644 index 0000000..b1abea2 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_103w.txt @@ -0,0 +1,8 @@ +dataset: </g1/d1> and </g1/d2> +size: [3x2] [3x2] +position d1 d2 difference +------------------------------------------------------------ +[ 0 1 ] 1e-016 4e-016 3e-016 +[ 2 0 ] 3.3e-016 1e-016 2.3e-016 +2 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_104.txt b/tools/h5diff/testfiles/h5diff_104.txt new file mode 100644 index 0000000..2997f10 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_104.txt @@ -0,0 +1,8 @@ +dataset: </g1/fp1> and </g1/fp2> +size: [3x2] [3x2] +position fp1 fp2 difference +------------------------------------------------------------ +[ 1 0 ] 1e-07 3e-07 2e-07 +[ 1 1 ] 2.2e-07 1e-07 1.2e-07 +2 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_104w.txt b/tools/h5diff/testfiles/h5diff_104w.txt new file mode 100644 index 0000000..28ef705 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_104w.txt @@ -0,0 +1,8 @@ +dataset: </g1/fp1> and </g1/fp2> +size: [3x2] [3x2] +position fp1 fp2 difference +------------------------------------------------------------ +[ 1 0 ] 1e-007 3e-007 2e-007 +[ 1 1 ] 2.2e-007 1e-007 1.2e-007 +2 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt index efc05a8..e6e4607 100644 --- a/tools/h5diff/testfiles/h5diff_600.txt +++ b/tools/h5diff/testfiles/h5diff_600.txt @@ -60,17 +60,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt index c66c650..7b917d4 100644 --- a/tools/h5diff/testfiles/h5diff_603.txt +++ b/tools/h5diff/testfiles/h5diff_603.txt @@ -61,17 +61,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt index 705ae3e..110986a 100644 --- a/tools/h5diff/testfiles/h5diff_606.txt +++ b/tools/h5diff/testfiles/h5diff_606.txt @@ -61,17 +61,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt index d38e9d4..782f5b4 100644 --- a/tools/h5diff/testfiles/h5diff_612.txt +++ b/tools/h5diff/testfiles/h5diff_612.txt @@ -61,17 +61,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt index 4b95ea1..f816510 100644 --- a/tools/h5diff/testfiles/h5diff_615.txt +++ b/tools/h5diff/testfiles/h5diff_615.txt @@ -61,17 +61,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt index 56ed724..8dc8824 100644 --- a/tools/h5diff/testfiles/h5diff_621.txt +++ b/tools/h5diff/testfiles/h5diff_621.txt @@ -61,17 +61,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt index 6e2db1b..f2f2089 100644 --- a/tools/h5diff/testfiles/h5diff_622.txt +++ b/tools/h5diff/testfiles/h5diff_622.txt @@ -61,17 +61,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt index 910f4f0..840b127 100644 --- a/tools/h5diff/testfiles/h5diff_623.txt +++ b/tools/h5diff/testfiles/h5diff_623.txt @@ -61,17 +61,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt index e301645..1d433a7 100644 --- a/tools/h5diff/testfiles/h5diff_624.txt +++ b/tools/h5diff/testfiles/h5diff_624.txt @@ -61,17 +61,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] number. -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. - --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the - system epsilon value. - If the system epsilon is not defined, use the value - below: + --use-system-epsilon Print difference if (|a-b| > EPSILON), EPSILON is + a system epsilon value. + The system epsilon values are defined as below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for - comparing floating point values. - By default, strict equality is used. Use -p or -d to - set specific tolerance. --exclude-path "path" Exclude the specified path to an object when comparing files or groups. If a group is excluded, all member objects will also be excluded. diff --git a/tools/h5diff/testfiles/h5diff_basic1.h5 b/tools/h5diff/testfiles/h5diff_basic1.h5 Binary files differindex 4ed83c8..4f3cf9a 100644 --- a/tools/h5diff/testfiles/h5diff_basic1.h5 +++ b/tools/h5diff/testfiles/h5diff_basic1.h5 diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 926ea27..1a4d5e8 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -601,10 +601,18 @@ else fi # 11. floating point comparison +# double value TOOLTEST h5diff_101.txt -v $FILE1 $FILE1 g1/d1 g1/d2 +# float value TOOLTEST h5diff_102.txt -v $FILE1 $FILE1 g1/fp1 g1/fp2 +# with --use-system-epsilon for double value +TOOLTEST h5diff_103.txt -v --use-system-epsilon $FILE1 $FILE1 g1/d1 g1/d2 + +# with --use-system-epsilon for float value +TOOLTEST h5diff_104.txt -v --use-system-epsilon $FILE1 $FILE1 g1/fp1 g1/fp2 + # not comparable -c flag TOOLTEST h5diff_200.txt $FILE2 $FILE2 g2/dset1 g2/dset2 diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 9a609b5..c4c8dbf 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -5550,7 +5550,7 @@ error: /*------------------------------------------------------------------------- * Function: equal_double * - * Purpose: use a relative error formula to deal with floating point + * Purpose: use a absolute error formula to deal with floating point * uncertainty * * Modifications: @@ -5604,7 +5604,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) /*------------------------------------------------------------------------- * Function: equal_ldouble * - * Purpose: use a relative error formula to deal with floating point + * Purpose: use a absolute error formula to deal with floating point * uncertainty * *------------------------------------------------------------------------- @@ -5660,7 +5660,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio /*------------------------------------------------------------------------- * Function: equal_float * - * Purpose: use a relative error formula to deal with floating point + * Purpose: use a absolute error formula to deal with floating point * uncertainty * * Modifications: |