From eb266def0282eae0fc982f8575664889be43c6ad Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Fri, 16 Apr 2004 16:24:51 -0500 Subject: [svn-r8359] Purpose: bug fix. Description: On LANL QSC, test/dtypes "sw long double -> double" had failed when the long double values were too small, smaller than the minimum double normalized floating number. The hw in QSC converts them mostly to 0 but occasionally, it converts to the some non-zero values which are still <= the minimum double normalized number. But the conversion verification did not like them and flagged them as errors. Solution: Added code to check if the src value is already smaller than the minimum number the float class can hold. When that happens and if both hw and sw conversion results are <= the minimum number, then accepts them as okay because if the src is smaller than the dst minimum number, an underflow has occured. Platforms tested: Tested in LANL QSC and Theta. --- test/dtypes.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/dtypes.c b/test/dtypes.c index 25f21f5..95e82aa 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -3921,6 +3921,11 @@ my_isnan(flt_t type, void *val) * Tuesday, June 23, 1998 * * Modifications: + * Albert Cheng, Apr 16, 2004 + * Check for underflow condition. If the src number is + * smaller than the dst MIN float number, consider it okay + * if the converted sw and hw dst are both less than or + * equal to the dst MIN float number. * *------------------------------------------------------------------------- */ @@ -3946,6 +3951,8 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst) long double hw_ld; /*hardware-converted */ #endif unsigned char *hw=NULL; /*ptr to hardware-conv'd*/ + int underflow; /*underflow occurred */ + int uflow=0; /*underflow debug counters*/ size_t i, j, k; /*counters */ int endian; /*machine endianess */ size_t src_ebias; /* Source type's exponent bias */ @@ -4114,6 +4121,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst) /* Check the software results against the hardware */ for (j=0; j