X Tutup
Skip to content

Commit 06bb674

Browse files
committed
Merged revisions 75561 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r75561 | mark.dickinson | 2009-10-20 14:33:03 +0100 (Tue, 20 Oct 2009) | 3 lines Issue python#7099: Decimal.is_normal should return True for all nonzero finite non-subnormal values, even those with exponent > Emax. ........
1 parent afaf48b commit 06bb674

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

Lib/decimal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3000,7 +3000,7 @@ def is_normal(self, context=None):
30003000
return False
30013001
if context is None:
30023002
context = getcontext()
3003-
return context.Emin <= self.adjusted() <= context.Emax
3003+
return context.Emin <= self.adjusted()
30043004

30053005
def is_qnan(self):
30063006
"""Return True if self is a quiet NaN; otherwise return False."""

Lib/test/decimaltestdata/extra.decTest

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,10 +1128,10 @@ bool0932 isnormal 1E+998 -> 1
11281128
bool0933 isnormal -1E+998 -> 1
11291129
bool0934 isnormal 1E+999 -> 1
11301130
bool0935 isnormal -1E+999 -> 1
1131-
bool0936 isnormal 1E+1000 -> 0
1132-
bool0937 isnormal -1E+1000 -> 0
1133-
bool0938 isnormal 1E+2000 -> 0
1134-
bool0939 isnormal -1E+2000 -> 0
1131+
bool0936 isnormal 1E+1000 -> 1
1132+
bool0937 isnormal -1E+1000 -> 1
1133+
bool0938 isnormal 1E+2000 -> 1
1134+
bool0939 isnormal -1E+2000 -> 1
11351135
bool0940 isnormal 9E-2000 -> 0
11361136
bool0941 isnormal -9E-2000 -> 0
11371137
bool0942 isnormal 9E-1008 -> 0
@@ -1178,10 +1178,10 @@ bool0982 isnormal 9E+998 -> 1
11781178
bool0983 isnormal -9E+998 -> 1
11791179
bool0984 isnormal 9E+999 -> 1
11801180
bool0985 isnormal -9E+999 -> 1
1181-
bool0986 isnormal 9E+1000 -> 0
1182-
bool0987 isnormal -9E+1000 -> 0
1183-
bool0988 isnormal 9E+2000 -> 0
1184-
bool0989 isnormal -9E+2000 -> 0
1181+
bool0986 isnormal 9E+1000 -> 1
1182+
bool0987 isnormal -9E+1000 -> 1
1183+
bool0988 isnormal 9E+2000 -> 1
1184+
bool0989 isnormal -9E+2000 -> 1
11851185
bool0990 isnormal 9.99999999E-2000 -> 0
11861186
bool0991 isnormal -9.99999999E-2000 -> 0
11871187
bool0992 isnormal 9.99999999E-1008 -> 0
@@ -1228,10 +1228,10 @@ bool1032 isnormal 9.99999999E+998 -> 1
12281228
bool1033 isnormal -9.99999999E+998 -> 1
12291229
bool1034 isnormal 9.99999999E+999 -> 1
12301230
bool1035 isnormal -9.99999999E+999 -> 1
1231-
bool1036 isnormal 9.99999999E+1000 -> 0
1232-
bool1037 isnormal -9.99999999E+1000 -> 0
1233-
bool1038 isnormal 9.99999999E+2000 -> 0
1234-
bool1039 isnormal -9.99999999E+2000 -> 0
1231+
bool1036 isnormal 9.99999999E+1000 -> 1
1232+
bool1037 isnormal -9.99999999E+1000 -> 1
1233+
bool1038 isnormal 9.99999999E+2000 -> 1
1234+
bool1039 isnormal -9.99999999E+2000 -> 1
12351235
bool1040 isnormal Infinity -> 0
12361236
bool1041 isnormal -Infinity -> 0
12371237
bool1042 isnormal NaN -> 0

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ C-API
100100
Library
101101
-------
102102

103+
- Issue #7099: Decimal.is_normal now returns True for numbers with exponent
104+
larger than emax.
105+
103106
- Issue #7080: locale.strxfrm() raises a MemoryError on 64-bit non-Windows
104107
platforms, and assorted locale fixes by Derk Drukker.
105108

0 commit comments

Comments
 (0)
X Tutup