diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-28 17:02:12 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-28 17:02:12 (GMT) |
commit | 12ba2eed6ad676507de5ad5aabe2e3631d8a1100 (patch) | |
tree | 57488773a49ee6c58f52352412052aa789505113 /test | |
parent | b3d2f04490363a24f1d43581116a61356ca89f77 (diff) | |
download | hdf5-12ba2eed6ad676507de5ad5aabe2e3631d8a1100.zip hdf5-12ba2eed6ad676507de5ad5aabe2e3631d8a1100.tar.gz hdf5-12ba2eed6ad676507de5ad5aabe2e3631d8a1100.tar.bz2 |
[svn-r8425] Purpose:
Bug fix (sorta)
Description:
The SGI machines have problems accurately (and consistently) converting
unsigned long values to float and double values, so put in a bit of a hack in
the datatype conversion test code to allow them to get "close enough". This
hack is enabled at configure time by a flag which should only be set on machines
with this problem.
Platforms tested:
FreeBSD 4.9 (sleipnir)
h5committest
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index 27b4874..7e0b71b 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -4494,6 +4494,35 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst) } } } +/* On some machines (notably the SGI machines) unsigned long values + * are not converted to float or double values correctly, they are + * consistently off by the lowest bit being rounded oppositely to our + * software conversion routines output. So, on those machines, we allow + * the converted value to be +/- 1 from the machine's value. -QAK + */ +#ifndef H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS + if(dst_size==sizeof(unsigned)) { + unsigned tmp_s, tmp_h; + HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned)); + HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned)); + if((tmp_s+1)==tmp_h || (tmp_s-1)==tmp_h) + continue; /*no error*/ + } /* end if */ + else if (dst_size==sizeof(unsigned long)) { + unsigned long tmp_s, tmp_h; + HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long)); + HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long)); + if((tmp_s+1)==tmp_h || (tmp_s-1)==tmp_h) + continue; /*no error*/ + } /* end if */ + else if (dst_size==sizeof(unsigned long long)) { + unsigned long long tmp_s, tmp_h; + HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long long)); + HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long long)); + if((tmp_s+1)==tmp_h || (tmp_s-1)==tmp_h) + continue; /*no error*/ + } /* end if */ +#endif /* end H5_ULONG_FP_BOTTOM_BIT_WORKS */ /* Print errors */ if (0==fails_this_test++) @@ -5546,26 +5575,16 @@ run_int_float_conv(const char *name) nerrors += test_conv_int_float(name, H5T_NATIVE_LONG, H5T_NATIVE_FLOAT); nerrors += test_conv_int_float(name, H5T_NATIVE_LONG, H5T_NATIVE_DOUBLE); - /* Temporarily disable these tests for software conversion. They fail on - * some systems(like modi4, premium, o2 and arabica) - */ - if(!strcmp(name, "hw")) { - nerrors += test_conv_int_float(name, H5T_NATIVE_ULONG, H5T_NATIVE_FLOAT); - nerrors += test_conv_int_float(name, H5T_NATIVE_ULONG, H5T_NATIVE_DOUBLE); - } + nerrors += test_conv_int_float(name, H5T_NATIVE_ULONG, H5T_NATIVE_FLOAT); + nerrors += test_conv_int_float(name, H5T_NATIVE_ULONG, H5T_NATIVE_DOUBLE); #endif #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG nerrors += test_conv_int_float(name, H5T_NATIVE_LLONG, H5T_NATIVE_FLOAT); nerrors += test_conv_int_float(name, H5T_NATIVE_LLONG, H5T_NATIVE_DOUBLE); - /* Temporarily disable these tests for software conversion. They fail on - * some systems(like modi4, premium, o2 and arabica) - */ - if(!strcmp(name, "hw")) { - nerrors += test_conv_int_float(name, H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT); - nerrors += test_conv_int_float(name, H5T_NATIVE_ULLONG, H5T_NATIVE_DOUBLE); - } + nerrors += test_conv_int_float(name, H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT); + nerrors += test_conv_int_float(name, H5T_NATIVE_ULLONG, H5T_NATIVE_DOUBLE); #endif return nerrors; @@ -5621,14 +5640,8 @@ run_float_int_conv(const char *name) nerrors += test_conv_int_float(name, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG); nerrors += test_conv_int_float(name, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG); - /* Temporarily disable these two tests for software conversion because of - * the bug in pgcc compiler. - * Will turn it back once the problem is solved. - */ - if(!strcmp(name, "hw")) { - nerrors += test_conv_int_float(name, H5T_NATIVE_FLOAT, H5T_NATIVE_ULLONG); - nerrors += test_conv_int_float(name, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULLONG); - } + nerrors += test_conv_int_float(name, H5T_NATIVE_FLOAT, H5T_NATIVE_ULLONG); + nerrors += test_conv_int_float(name, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULLONG); #endif return nerrors; |