summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-07-03 01:16:22 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-07-03 01:16:22 (GMT)
commit203a7329154d957480aa83f8508276197e4738f4 (patch)
treef752776b0a688b520d7b8b90ed296242b5aad019 /src
parentb81abe336d5ab6498fc6e382822a9f85be1af8e9 (diff)
downloadhdf5-203a7329154d957480aa83f8508276197e4738f4.zip
hdf5-203a7329154d957480aa83f8508276197e4738f4.tar.gz
hdf5-203a7329154d957480aa83f8508276197e4738f4.tar.bz2
[svn-r446] Changes since 19980702
---------------------- ./MANIFEST Added new files from testpar directory. ./config/commence.in Removed -D_POSIX_SOURCE because hdf5 uses a couple of non-Posix things when certain debugging flags are switched on.
Diffstat (limited to 'src')
-rw-r--r--src/H5Tconv.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 930b330..800a9ea 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -13,6 +13,7 @@
#include <H5Eprivate.h>
#include <H5MMprivate.h>
#include <H5Tpkg.h>
+#include <float.h> /*for FLT_MAX and FLT_MIN */
#include <math.h> /*for ceil() */
/* Conversion data for H5T_conv_struct() */
@@ -1349,8 +1350,19 @@ H5T_conv_double_float (hid_t __unused__ src_id, hid_t __unused__ dst_id,
s = (double*)buf;
d = (float*)buf;
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- *d++ = *s++;
+ /*
+ * We have to watch out because some machines generate a SIGFPE if
+ * the source has a larger magnitude than can be represented in the
+ * destination.
+ */
+ for (elmtno=0; elmtno<nelmts; elmtno++, d++, s++) {
+ if (*s > FLT_MAX) {
+ *d = FLT_MAX;
+ } else if (*s < -FLT_MAX) {
+ *d = -FLT_MAX;
+ } else {
+ *d = *s;
+ }
}
break;