[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r11068 - in /libdfp/trunk: ChangeLog ieee754r/isinfd32.c tests/test-isfinite.c
- To: commits@xxxxxxxxxx
- Subject: [commits] r11068 - in /libdfp/trunk: ChangeLog ieee754r/isinfd32.c tests/test-isfinite.c
- From: ryanarn@xxxxxxxxxx
- Date: Mon, 26 Jul 2010 21:22:45 -0000
Author: ryanarn
Date: Mon Jul 26 14:22:45 2010
New Revision: 11068
Log:
Fix isinfd[32|64|128]() bug found on s390 (but also erroneous on Power) by
Christian Borntraeger. Also changed the expected return value in isfinite
test case since s390 returns positive '1' for negative number inputs, whereas
Power returns -1.
2010-07-26 Ryan S. Arnold <rsa@xxxxxxxxxx>
* ieee754r/isinfd32.c (isinf): Changed Infinity check such that
DEC_NAN doesn't pass as inf. There was an incorrect mask check which
was true for DEC_NAN as well as Inf.
* tests/test-isfinite.c: Added Conditional expectations for s390 for
isfinite return values from negative number inputs.
Modified:
libdfp/trunk/ChangeLog
libdfp/trunk/ieee754r/isinfd32.c
libdfp/trunk/tests/test-isfinite.c
Modified: libdfp/trunk/ChangeLog
==============================================================================
--- libdfp/trunk/ChangeLog (original)
+++ libdfp/trunk/ChangeLog Mon Jul 26 14:22:45 2010
@@ -1,3 +1,12 @@
+2010-07-26 Ryan S. Arnold <rsa@xxxxxxxxxx>
+
+ * ieee754r/isinfd32.c (isinf): Changed Infinity check such that
+ DEC_NAN doesn't pass as inf. There was an incorrect mask check which
+ was true for DEC_NAN as well as Inf.
+ * tests/test-isfinite.c: Added Conditional expectations for s390 for
+ isfinite return values from negative number inputs.
+
+
2010-07-23 Ryan S. Arnold <rsa@xxxxxxxxxx>
* tests/test-logd.c: Removed unnecessary comments.
Modified: libdfp/trunk/ieee754r/isinfd32.c
==============================================================================
--- libdfp/trunk/ieee754r/isinfd32.c (original)
+++ libdfp/trunk/ieee754r/isinfd32.c Mon Jul 26 14:22:45 2010
@@ -35,6 +35,30 @@
#include <dfpmacro.h>
+#include "../tests/scaffold.c"
+
+
+static void bin_prnt_byte(int x)
+{
+ int n;
+ for(n=0; n<8; n++)
+ {
+ if((x & 0x80) !=0)
+ {
+ printf("1");
+ }
+ else
+ {
+ printf("0");
+ }
+ x = x<<1;
+ }
+}
+
+
+
+#include <stdio.h>
+
int
INTERNAL_FUNCTION_NAME (DEC_TYPE x)
{
@@ -43,16 +67,20 @@
{
DEC_TYPE dec;
uint8_t bytes[_DECIMAL_SIZE/8];
+ uint32_t words[_DECIMAL_SIZE/32];
} u_conv;
+ static char foo[CHAR_MAX];
u_conv.dec = x;
#if BYTE_ORDER == BIG_ENDIAN
top_byte = u_conv.bytes[0];
#else
- top_byte = u.conv.bytes[_DECIMAL_SIZE/8 -1];
+ top_byte = u_conv.bytes[_DECIMAL_SIZE/8 -1];
#endif
- return (top_byte & DECIMAL_Inf) == DECIMAL_Inf;
+ /* a NaN is not Inf, but the bitmasks overlap, so extract everything for NaN
+ * and if there are more bits than DECIMAL_Inf it is a NaN and not an Inf. */
+ return (top_byte & DECIMAL_NaN) == DECIMAL_Inf;
}
weak_alias (INTERNAL_FUNCTION_NAME, EXTERNAL_FUNCTION_NAME)
Modified: libdfp/trunk/tests/test-isfinite.c
==============================================================================
--- libdfp/trunk/tests/test-isfinite.c (original)
+++ libdfp/trunk/tests/test-isfinite.c Mon Jul 26 14:22:45 2010
@@ -48,9 +48,13 @@
{__LINE__, DEC_NAN, 0, "%d"},
{__LINE__, HUGE_VAL_D128, 0, "%d"},
{__LINE__, DEC_INFINITY, 0, "%d"},
+#if defined __s390__ || defined __s390x__
+ {__LINE__, -1.95DL, 1, "%d"},
+#else
/* isfinite returns 'nonzero' if the argument is finite. This could be
* anything other than zero. */
{__LINE__, -1.95DL, -1, "%d"},
+#endif
{0,0,0,0 }
};
@@ -67,7 +71,14 @@
{__LINE__, DEC_NAN, 0, "%d"},
{__LINE__, HUGE_VAL_D64, 0, "%d"},
{__LINE__, DEC_INFINITY, 0, "%d"},
+#if defined __s390__ || defined __s390x__
+ {__LINE__, -1.95DD, 1, "%d"},
+#else
+ /* isfinite returns 'nonzero' if the argument is finite. This could be
+ * anything other than zero. */
{__LINE__, -1.95DD, -1, "%d"},
+#endif
+
{0,0,0,0 }
};
@@ -84,7 +95,13 @@
{__LINE__, DEC_NAN, 0, "%d"},
{__LINE__, HUGE_VAL_D32, 0, "%d"},
{__LINE__, DEC_INFINITY, 0, "%d"},
+#if defined __s390__ || defined __s390x__
+ {__LINE__, -1.95DF, 1, "%d"},
+#else
+ /* isfinite returns 'nonzero' if the argument is finite. This could be
+ * anything other than zero. */
{__LINE__, -1.95DF, -1, "%d"},
+#endif
{0,0,0,0 }
};