This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Decimal.is_normal should return True even for numbers with exponent > Emax
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: mark.dickinson, skrah
Priority: normal Keywords:

Created on 2009-10-10 18:45 by mark.dickinson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg93838 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-10-10 18:45
Noticed by Stefan Krah:

Python 2.7a0 (trunk:75309, Oct 10 2009, 13:44:18) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import *
>>> x = Decimal('9.99999999e+1000')
>>> c = getcontext()
>>> c.prec = 9
>>> c.Emax = 999
>>> c.Emin = -999
>>> 
>>> x.is_normal()
False
>>> x.is_subnormal()
False
>>> x.is_infinite()
False
>>> x.is_nan()
False
>>> x.is_zero()
False

So if x isn't normal, subnormal, zero, nan or infinity, what the ****
is it?!

x.is_normal() should probably be returning True here.
msg93888 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-10-12 08:02
Note to self:  when fixing this, make sure that Decimal.number_class is
also behaving sensibly.
msg94274 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-10-20 13:41
Fixed in r75561 (trunk), r75662 (py3k) and r75663 (release31-maint).
release26-maint is still frozen; leaving open for the backport.
msg94571 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-10-27 18:28
Merged to release26-maint in r75822.
History
Date User Action Args
2022-04-11 14:56:53adminsetgithub: 51348
2009-10-27 18:28:40mark.dickinsonsetstatus: open -> closed

messages: + msg94571
2009-10-20 13:41:11mark.dickinsonsetresolution: fixed
messages: + msg94274
versions: - Python 3.1, Python 2.7, Python 3.2
2009-10-12 08:02:54mark.dickinsonsetmessages: + msg93888
2009-10-10 18:45:21mark.dickinsoncreate