[Python-checkins] r75561 - in python/trunk: Lib/decimal.py Lib/test/decimaltestdata/extra.decTest Misc/NEWS

mark.dickinson python-checkins at python.org
Tue Oct 20 15:33:03 CEST 2009


Author: mark.dickinson
Date: Tue Oct 20 15:33:03 2009
New Revision: 75561

Log:
Issue #7099: Decimal.is_normal should return True for all nonzero
finite non-subnormal values, even those with exponent > Emax.


Modified:
   python/trunk/Lib/decimal.py
   python/trunk/Lib/test/decimaltestdata/extra.decTest
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/decimal.py
==============================================================================
--- python/trunk/Lib/decimal.py	(original)
+++ python/trunk/Lib/decimal.py	Tue Oct 20 15:33:03 2009
@@ -2917,7 +2917,7 @@
             return False
         if context is None:
             context = getcontext()
-        return context.Emin <= self.adjusted() <= context.Emax
+        return context.Emin <= self.adjusted()
 
     def is_qnan(self):
         """Return True if self is a quiet NaN; otherwise return False."""

Modified: python/trunk/Lib/test/decimaltestdata/extra.decTest
==============================================================================
--- python/trunk/Lib/test/decimaltestdata/extra.decTest	(original)
+++ python/trunk/Lib/test/decimaltestdata/extra.decTest	Tue Oct 20 15:33:03 2009
@@ -1128,10 +1128,10 @@
 bool0933 isnormal -1E+998 -> 1
 bool0934 isnormal 1E+999 -> 1
 bool0935 isnormal -1E+999 -> 1
-bool0936 isnormal 1E+1000 -> 0
-bool0937 isnormal -1E+1000 -> 0
-bool0938 isnormal 1E+2000 -> 0
-bool0939 isnormal -1E+2000 -> 0
+bool0936 isnormal 1E+1000 -> 1
+bool0937 isnormal -1E+1000 -> 1
+bool0938 isnormal 1E+2000 -> 1
+bool0939 isnormal -1E+2000 -> 1
 bool0940 isnormal 9E-2000 -> 0
 bool0941 isnormal -9E-2000 -> 0
 bool0942 isnormal 9E-1008 -> 0
@@ -1178,10 +1178,10 @@
 bool0983 isnormal -9E+998 -> 1
 bool0984 isnormal 9E+999 -> 1
 bool0985 isnormal -9E+999 -> 1
-bool0986 isnormal 9E+1000 -> 0
-bool0987 isnormal -9E+1000 -> 0
-bool0988 isnormal 9E+2000 -> 0
-bool0989 isnormal -9E+2000 -> 0
+bool0986 isnormal 9E+1000 -> 1
+bool0987 isnormal -9E+1000 -> 1
+bool0988 isnormal 9E+2000 -> 1
+bool0989 isnormal -9E+2000 -> 1
 bool0990 isnormal 9.99999999E-2000 -> 0
 bool0991 isnormal -9.99999999E-2000 -> 0
 bool0992 isnormal 9.99999999E-1008 -> 0
@@ -1228,10 +1228,10 @@
 bool1033 isnormal -9.99999999E+998 -> 1
 bool1034 isnormal 9.99999999E+999 -> 1
 bool1035 isnormal -9.99999999E+999 -> 1
-bool1036 isnormal 9.99999999E+1000 -> 0
-bool1037 isnormal -9.99999999E+1000 -> 0
-bool1038 isnormal 9.99999999E+2000 -> 0
-bool1039 isnormal -9.99999999E+2000 -> 0
+bool1036 isnormal 9.99999999E+1000 -> 1
+bool1037 isnormal -9.99999999E+1000 -> 1
+bool1038 isnormal 9.99999999E+2000 -> 1
+bool1039 isnormal -9.99999999E+2000 -> 1
 bool1040 isnormal Infinity -> 0
 bool1041 isnormal -Infinity -> 0
 bool1042 isnormal NaN -> 0

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue Oct 20 15:33:03 2009
@@ -414,6 +414,9 @@
 Library
 -------
 
+- Issue #7099: Decimal.is_normal now returns True for numbers with exponent
+  larger than emax.
+
 - Issue #5833: Fix extra space character in readline completion with the
   GNU readline library version 6.0.
 


More information about the Python-checkins mailing list