summaryrefslogtreecommitdiffstats
path: root/Lib/decimal.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix docstring typo.Mark Dickinson2008-02-291-1/+1
|
* Add __format__ method to Decimal, to support PEP 3101Mark Dickinson2008-02-291-0/+240
|
* Remove duplicate 'import re' in decimal.pyMark Dickinson2008-02-241-2/+1
|
* Fix decimal repr which should have used single quotes like other reprs.Raymond Hettinger2008-02-141-242/+242
|
* Bring decimal a bit closer to the spec for Reals.Raymond Hettinger2008-02-121-0/+14
|
* Typos in decimal comment and documentationMark Dickinson2008-02-101-1/+1
|
* Issue 1979: Make Decimal comparisons (other than !=, ==) involving NaNMark Dickinson2008-02-061-39/+110
| | | | raise InvalidOperation (and return False if InvalidOperation is trapped).
* Add support for trunc().Raymond Hettinger2008-01-241-0/+2
|
* Docstring typosAndrew M. Kuchling2008-01-161-3/+3
|
* Issue 1780: Allow leading and trailing whitespace in Decimal constructor,Mark Dickinson2008-01-121-3/+14
| | | | | when constructing from a string. Disallow trailing newlines in Context.create_decimal.
* Have Decimal.as_tuple return a named tuple.Raymond Hettinger2008-01-111-1/+7
|
* Issue #1757: The hash of a Decimal instance is no longer affectedFacundo Batista2008-01-081-3/+11
| | | | by the current context. Thanks Mark Dickinson.
* Some minor cleanups. Thanks Mark Dickinson.Facundo Batista2007-12-191-34/+19
|
* Removed the private _rounding_decision: it was not needed, and the codeFacundo Batista2007-12-171-94/+38
| | | | is now simpler. Thanks Mark Dickinson.
* fma speedup by avoiding to create a Context. Thanks Mark Dickinson.Facundo Batista2007-12-041-16/+31
|
* Faster _fix function, and some reordering for a more elegantFacundo Batista2007-12-031-52/+47
| | | | coding. Thanks Mark Dickinson.
* Speedup and cleaning of __str__. Thanks Mark Dickinson.Facundo Batista2007-12-031-71/+41
|
* Reordering of __new__ to minimize isinstance() calls to mostFacundo Batista2007-11-301-55/+56
| | | | used types. Thanks Mark Dickinson.
* Major change in the internal structure of the DecimalFacundo Batista2007-11-231-302/+219
| | | | | | | | | | number: now it does not store the mantissa as a tuple of numbers, but as a string. This avoids a lot of conversions, and achieves a speedup of 40%. The API remains intact. Thanks Mark Dickinson.
* The constructor from tuple was way too permissive: it allowed badFacundo Batista2007-10-191-10/+36
| | | | | | | | coefficient numbers, floats in the sign, and other details that generated directly the wrong number in the best case, or triggered misfunctionality in the alorithms. Test cases added for these issues. Thanks Mark Dickinson.
* Added a class to store the digits of log(10), so that they can be madeFacundo Batista2007-10-021-16/+49
| | | | available when necessary without recomputing. Thanks Mark Dickinson
* Made the various is_* operations return booleans. This was discussedFacundo Batista2007-10-021-112/+95
| | | | | | | | | | | with Cawlishaw by mail, and he basically confirmed that to these is_* operations, there's no need to return Decimal(0) and Decimal(1) if the language supports the False and True booleans. Also added a few tests for the these functions in extra.decTest, since they are mostly untested (apart from the doctests). Thanks Mark Dickinson
* Issue #1772851. Optimization of __hash__ to behave better for big bigFacundo Batista2007-09-191-4/+11
| | | | numbers.
* Speed up of the various division operations (remainder, divide,Facundo Batista2007-09-181-161/+139
| | | | divideint and divmod). Thanks Mark Dickinson.
* The methods always return Decimal classes, even if they'reFacundo Batista2007-09-171-34/+38
| | | | | executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this.
* Put the parameter watchexp back in (changed watchexp from an intFacundo Batista2007-09-131-2/+13
| | | | | | | to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson.
* Merged the decimal-branch (revisions 54886 to 58140). Decimal is nowFacundo Batista2007-09-131-702/+2846
| | | | | | | fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process.
* When passed a bad formed literal to Decimal, now we have aFacundo Batista2007-08-151-1/+2
| | | | better error message, more descriptive. (bug #1770009)
* Whitespace normalization. Ugh, we really need to do this more often.Neal Norwitz2007-04-251-4/+4
| | | | You might want to review this change as it's my first time. Be gentle. :-)
* General clean-up. Lot of margin corrections, comments, some typos.Facundo Batista2007-04-101-159/+170
| | | | | Exceptions now are raised in the new style. And a mockup class is now also new style. Thanks Santiago Pereson.
* Fix docstring bugRaymond Hettinger2007-02-081-1/+1
|
* Add missing word in commentNeal Norwitz2006-09-021-1/+1
|
* Make decimal.ContextManager a private implementation detail of ↵Nick Coghlan2006-09-021-24/+5
| | | | decimal.localcontext()
* Fix the wrongheaded implementation of context management in the decimal ↵Nick Coghlan2006-08-311-15/+65
| | | | module and add unit tests. (python-dev discussion is ongoing regarding what we do about Python 2.5)
* Revert r50706 (Whitespace normalization) andMartin v. Löwis2006-07-191-205/+184
| | | | | r50697: Comments and docs cleanups, and some little fixes per recommendation from Raymond Hettinger.
* Whitespace normalization.Tim Peters2006-07-181-6/+6
|
* Comments and docs cleanups, and some little fixes, provided by Santiágo ↵Facundo Batista2006-07-181-184/+205
| | | | Peresón
* Typo fix.Georg Brandl2006-05-111-1/+1
|
* Finish bringing SVN into line with latest version of PEP 343 by getting rid ↵Nick Coghlan2006-05-031-3/+3
| | | | of all remaining references to context objects that I could find. Without a __context__() method context objects no longer exist. Also get test_with working again, and adopt a suggestion from Neal for decimal.Context.get_manager()
* Get rid of __context__, per the latest changes to PEP 343 and python-devGuido van Rossum2006-05-021-1/+1
| | | | | | | | discussion. There are two places of documentation that still mention __context__: Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without spending a whole lot of time thinking about it; and whatsnew, which Andrew usually likes to change himself.
* Move the PEP 343 documentation and implementation closer to theNick Coghlan2006-04-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | terminology in the alpha 1 documentation. - "context manager" reverts to its alpha 1 definition - the term "context specifier" goes away entirely - contextlib.GeneratorContextManager is renamed GeneratorContext There are still a number of changes relative to alpha 1: - the expression in the with statement is explicitly called the "context expression" in the language reference - the terms 'with statement context', 'context object' or 'with statement context' are used in several places instead of a bare 'context'. The aim of this is to avoid ambiguity in relation to the runtime context set up when the block is executed, and the context objects that already exist in various application domains (such as decimal.Context) - contextlib.contextmanager is renamed to contextfactory This best reflects the nature of the function resulting from the use of that decorator - decimal.ContextManager is renamed to WithStatementContext Simple dropping the 'Manager' part wasn't possible due to the fact that decimal.Context already exists and means something different. WithStatementContext is ugly but workable. A technically unrelated change snuck into this commit: contextlib.closing now avoids the overhead of creating a generator, since it's trivial to implement that particular context manager directly.
* Um, I thought I'd already checked this in.Guido van Rossum2006-03-101-2/+0
| | | | | | | Anyway, this is the changes to the with-statement so that __exit__ must return a true value in order for a pending exception to be ignored. The PEP (343) is already updated.
* Updates to the with-statement:Guido van Rossum2006-02-281-0/+29
| | | | | | | | | | | | | | | | - New semantics for __exit__() -- it must re-raise the exception if type is not None; the with-statement itself doesn't do this. (See the updated PEP for motivation.) - Added context managers to: - file - thread.LockType - threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore} - decimal.Context - Added contextlib.py, which defines @contextmanager, nested(), closing(). - Unit tests all around; bot no docs yet.
* bug [ 1266296 ] Mistakes in decimal.Context.subtract documentationGeorg Brandl2005-08-221-1/+1
|
* Apply the _is_special guard.Raymond Hettinger2005-06-201-12/+13
|
* Minor namespace clean-up.Raymond Hettinger2005-06-071-2/+2
|
* * Fix decimal's handling of foreign types. Now returns NotImplementedRaymond Hettinger2005-03-271-4/+39
| | | | | | | instead of raising a TypeError. Allows other types to successfully implement __radd__() style methods. * Remove future division import from test suite. * Remove test suite's shadowing of __builtin__.dir().
* Bug #1163325: "special" decimals aren't hashableRaymond Hettinger2005-03-151-0/+4
|
* Fix small grammatical error in a docstring.Brett Cannon2005-03-011-1/+1
|
* Replace list of constants with tuples of constants.Raymond Hettinger2005-02-061-1/+1
|