Skip to content

Commit

Permalink
Fix up dsets test for some platforms with different long double format (
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendersonHDF authored Mar 11, 2024
1 parent 8340c4c commit 4279c35
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions test/dsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -5877,33 +5877,51 @@ test_floattypes(hid_t file)
if (H5Dclose(dataset) < 0)
goto error;
}
#if 0

#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
/* long double */
{
long double orig_data[2][5] = {
{(long double)1.6081706885101836e+600L, (long double)-255.3209917099448032099170994480,
(long double)1.2677579992621376e-610L, (long double)64568.289448797700289448797700,
(long double)-1.0619721778839084e-750L},
{(long double)2.1499497833454840991499497833454840e+560L,
{(long double)1.6081706885101836e+300L, (long double)-255.3209917099448032099170994480,
(long double)1.2677579992621376e-310L, (long double)64568.289448797700289448797700,
(long double)-1.0619721778839084e-310L},
{(long double)2.1499497833454840991499497833454840e+257L,
(long double)6.6562295504670740996562295504670740e-3,
(long double)-1.5747263393432150995747263393432150,
(long double)1.0711093225222612990711093225222612,
(long double)-9.8971679387636870998971679387636870e-1}};
long double new_data[2][5];
size_t old_precision;

TESTING(" long double (setup)");

/* Define user-defined quad-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_NATIVE_LDOUBLE);
precision = 128;
if (H5Tset_precision(datatype, precision) < 0)
goto error;
if (H5Tset_fields(datatype, (size_t)127, (size_t)112, (size_t)15, (size_t)0, (size_t)112) < 0)
goto error;
offset = 0;
if (H5Tset_offset(datatype, offset) < 0)
offset = 5;
precision = 123;
if (0 == (old_precision = H5Tget_precision(datatype)))
goto error;
if (old_precision < precision) {
/* Increasing precision, call H5Tset_precision first */
if (H5Tset_precision(datatype, precision) < 0)
goto error;
/* H5Tset_precision may have changed our offset */
if (H5Tset_offset(datatype, offset) < 0)
goto error;
if (H5Tset_fields(datatype, (size_t)127, (size_t)112, (size_t)15, (size_t)offset, (size_t)107) <
0)
goto error;
}
else {
/* Decreasing precision, call H5Tset_fields first */
if (H5Tset_offset(datatype, offset) < 0)
goto error;
if (H5Tset_fields(datatype, (size_t)127, (size_t)112, (size_t)15, (size_t)offset, (size_t)107) <
0)
goto error;
if (H5Tset_precision(datatype, precision) < 0)
goto error;
}
if (H5Tset_size(datatype, (size_t)16) < 0)
goto error;
if (H5Tset_ebias(datatype, (size_t)255) < 0)
Expand Down Expand Up @@ -5967,7 +5985,6 @@ test_floattypes(hid_t file)
if (H5Dclose(dataset) < 0)
goto error;
}
#endif
#endif

return SUCCEED;
Expand Down

0 comments on commit 4279c35

Please sign in to comment.