summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Reuse Py_MIN and Py_MAX macros: remove duplicate MIN/MAX macrosVictor Stinner2013-06-041-9/+4
| | | | multiprocessing.h: remove unused MIN and MAX macros
* Close #17694: Add minimum length to _PyUnicodeWriterVictor Stinner2013-04-171-1/+1
| | | | | | | | | | | | * Add also min_char attribute to _PyUnicodeWriter structure (currently unused) * _PyUnicodeWriter_Init() has no more argument (except the writer itself): min_length and overallocate must be set explicitly * In error handlers, only enable overallocation if the replacement string is longer than 1 character * CJK decoders don't use overallocation anymore * Set min_length, instead of preallocating memory using _PyUnicodeWriter_Prepare(), in many decoders * _PyUnicode_DecodeUnicodeInternal() checks for integer overflow
* Fix a few typos and a double semicolon. Patch by Eitan Adler.Ezio Melotti2013-01-271-1/+1
|
* Issue #14785: Add sys._debugmallocstats() to help debug low-level memory ↵David Malcolm2012-06-221-0/+10
| | | | allocation issues
* Issue #14744: Use the new _PyUnicodeWriter internal API to speed up str%args ↵Victor Stinner2012-05-291-7/+20
| | | | | | | | | | | | | | | | | and str.format(args) * Formatting string, int, float and complex use the _PyUnicodeWriter API. It avoids a temporary buffer in most cases. * Add _PyUnicodeWriter_WriteStr() to restore the PyAccu optimization: just keep a reference to the string if the output is only composed of one string * Disable overallocation when formatting the last argument of str%args and str.format(args) * Overallocation allocates at least 100 characters: add min_length attribute to the _PyUnicodeWriter structure * Add new private functions: _PyUnicode_FastCopyCharacters(), _PyUnicode_FastFill() and _PyUnicode_FromASCII() The speed up is around 20% in average.
* Issue #14435: Remove special block allocation code from floatobject.cKristján Valur Jónsson2012-03-301-131/+27
| | | | | | PyFloatObjects are now allocated using PyObject_MALLOC like all other internal types, but maintain a limited freelist of objects at hand for performance. This will result in more consistent memory usage by Python.
* Merge 3.2 -> default (issue 13889)Mark Dickinson2012-01-271-0/+5
|\
| * Issue #13889: Add missing _Py_SET_53BIT_PRECISION_* calls around uses of ↵Mark Dickinson2012-01-271-0/+5
| | | | | | | | dtoa.c functions in float round.
* | Issue #13088: Add shared Py_hexdigits constant to format a number into base 16Victor Stinner2011-10-141-1/+1
| |
* | Implement PEP 393.Martin v. Löwis2011-09-281-15/+4
| |
* | Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED.Brian Curtin2011-08-111-2/+1
| | | | | | | | The macro was introduced in #12724.
* | Issue #11495: OSF support is eliminated. It was deprecated in Python 3.2Jesus Cea2011-03-141-5/+0
| |
* | Issue #8914: fix various warnings from the Clang static analyzer v254.Brett Cannon2011-02-221-2/+1
|/
* Use copysign to produce appropriately signed zeros instead of trying to worm ↵Mark Dickinson2010-12-041-12/+5
| | | | around possible compiler optimizations.
* Issue #10596: Fix float.__mod__ to have the same behaviour asMark Dickinson2010-12-041-4/+14
| | | | float.__divmod__ with respect to signed zeros.
* Remove some unecessary '#ifdef Py_NAN's from floatobject.cMark Dickinson2010-12-041-6/+0
|
* Issue #10557: Fixed error messages from float() and other numericAlexander Belopolsky2010-12-041-26/+32
| | | | | | types. Added a new API function, PyUnicode_TransformDecimalToASCII(), which transforms non-ASCII decimal digits in a Unicode string to their ASCII equivalents.
* Include structseq.h in Python.h, and remove now-redundant includes in ↵Georg Brandl2010-11-301-1/+0
| | | | individual sources.
* make hashes always the size of pointers; introduce Py_hash_t #9778Benjamin Peterson2010-10-171-1/+1
|
* Issue #9337: Make float.__str__ identical to float.__repr__.Mark Dickinson2010-08-041-17/+5
| | | | (And similarly for complex numbers.)
* Style nit.Mark Dickinson2010-07-061-1/+1
|
* Merged revisions 82447 via svnmerge fromBenjamin Peterson2010-07-021-1/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r82447 | benjamin.peterson | 2010-07-02 14:41:39 -0500 (Fri, 02 Jul 2010) | 1 line add space ........
* Issue #9089: Remove references to intobject.c and intobject.h from comments.Mark Dickinson2010-06-271-1/+16
|
* Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-1900/+1900
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* Merged revisions 78319 via svnmerge fromEzio Melotti2010-02-221-1/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78319 | ezio.melotti | 2010-02-22 18:30:58 +0200 (Mon, 22 Feb 2010) | 1 line #7482: clarify error message in case of division by zero of float and complex numbers. ........
* Merged revisions 77139-77140 via svnmerge fromMark Dickinson2009-12-301-23/+74
| | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r77139 | mark.dickinson | 2009-12-30 12:12:23 +0000 (Wed, 30 Dec 2009) | 3 lines Issue #7534: Fix handling of nans, infinities, and negative zero in ** operator, on IEEE 754 platforms. Thanks Marcos Donolo for original patch. ........ r77140 | mark.dickinson | 2009-12-30 12:22:49 +0000 (Wed, 30 Dec 2009) | 1 line Add Marcos Donolo for work on issue 7534 patch. ........
* Merged revisions 76561 via svnmerge fromMark Dickinson2009-11-281-4/+0
| | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r76561 | mark.dickinson | 2009-11-28 12:30:36 +0000 (Sat, 28 Nov 2009) | 5 lines Include ieeefp.h (when available) in pyport.h instead of individually in Objects/floatobject.c and Objects/complexobject.c. This should silence compiler warnings about implicit declaration of the 'finite' function on Solaris. ........
* Fix extra-long line; also makes py3k match trunk here.Mark Dickinson2009-10-261-1/+1
|
* Merged revisions ↵Benjamin Peterson2009-06-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 73376,73393,73398,73400,73404-73405,73409,73419-73421,73432,73457,73460,73485-73486,73488-73489,73501-73502,73513-73514 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r73376 | benjamin.peterson | 2009-06-11 17:29:23 -0500 (Thu, 11 Jun 2009) | 1 line remove check for case handled in sub-function ........ r73393 | alexandre.vassalotti | 2009-06-12 13:56:57 -0500 (Fri, 12 Jun 2009) | 2 lines Clear reference to the static PyExc_RecursionErrorInst in _PyExc_Fini. ........ r73398 | alexandre.vassalotti | 2009-06-12 15:57:12 -0500 (Fri, 12 Jun 2009) | 3 lines Add const qualifier to PyErr_SetFromErrnoWithFilename and to PyErr_SetFromErrnoWithUnicodeFilename. ........ r73400 | alexandre.vassalotti | 2009-06-12 16:43:47 -0500 (Fri, 12 Jun 2009) | 2 lines Delete outdated make file for building the parser with MSVC 6. ........ r73404 | benjamin.peterson | 2009-06-12 20:40:00 -0500 (Fri, 12 Jun 2009) | 1 line keep the slice.step field as NULL if no step expression is given ........ r73405 | benjamin.peterson | 2009-06-12 22:46:30 -0500 (Fri, 12 Jun 2009) | 1 line prevent import statements from assigning to None ........ r73409 | benjamin.peterson | 2009-06-13 08:06:21 -0500 (Sat, 13 Jun 2009) | 1 line allow importing from a module named None if it has an 'as' clause ........ r73419 | benjamin.peterson | 2009-06-13 11:19:19 -0500 (Sat, 13 Jun 2009) | 1 line set Print.values to NULL if there are no values ........ r73420 | benjamin.peterson | 2009-06-13 12:08:53 -0500 (Sat, 13 Jun 2009) | 1 line give a better error message when deleting () ........ r73421 | benjamin.peterson | 2009-06-13 15:23:33 -0500 (Sat, 13 Jun 2009) | 1 line when no module is given in a 'from' relative import, make ImportFrom.module NULL ........ r73432 | amaury.forgeotdarc | 2009-06-14 16:20:40 -0500 (Sun, 14 Jun 2009) | 3 lines #6227: Because of a wrong indentation, the test was not testing what it should. Ensure that the snippet in doctest_aliases actually contains aliases. ........ r73457 | benjamin.peterson | 2009-06-16 18:13:09 -0500 (Tue, 16 Jun 2009) | 1 line add underscores ........ r73460 | benjamin.peterson | 2009-06-16 22:23:04 -0500 (Tue, 16 Jun 2009) | 1 line remove unused 'encoding' member from the compiler struct ........ r73485 | benjamin.peterson | 2009-06-19 17:07:47 -0500 (Fri, 19 Jun 2009) | 1 line remove duplicate test ........ r73486 | benjamin.peterson | 2009-06-19 17:09:17 -0500 (Fri, 19 Jun 2009) | 1 line add missing assertion #6313 ........ r73488 | benjamin.peterson | 2009-06-19 17:16:28 -0500 (Fri, 19 Jun 2009) | 1 line show that this one isn't used ........ r73489 | benjamin.peterson | 2009-06-19 17:21:12 -0500 (Fri, 19 Jun 2009) | 1 line use closures ........ r73501 | benjamin.peterson | 2009-06-21 18:01:07 -0500 (Sun, 21 Jun 2009) | 1 line don't need to add the name 'lambda' as assigned ........ r73502 | benjamin.peterson | 2009-06-21 18:03:36 -0500 (Sun, 21 Jun 2009) | 1 line remove tmpname support since it's no longer used ........ r73513 | benjamin.peterson | 2009-06-22 20:18:57 -0500 (Mon, 22 Jun 2009) | 1 line fix grammar ........ r73514 | benjamin.peterson | 2009-06-22 22:01:56 -0500 (Mon, 22 Jun 2009) | 1 line remove some unused symtable constants ........
* Refactor to remove duplicated nan/inf parsing code inMark Dickinson2009-05-201-36/+13
| | | | pystrtod.c, floatobject.c and dtoa.c.
* Merged revisions 72564 via svnmerge fromMark Dickinson2009-05-111-16/+36
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r72564 | mark.dickinson | 2009-05-11 16:33:08 +0100 (Mon, 11 May 2009) | 2 lines Issue #5981: Fix some float.fromhex bugs related to inf and nan handling. ........
* Issue #5920: Changed format.__float__ and complex.__float__ to use a ↵Eric Smith2009-05-051-4/+5
| | | | precision of 12 when using the empty presentation type. This more closely matches str()'s behavior and reduces surprises when adding alignment flags to an empty format string. Patch by Mark Dickinson.
* Merged revisions 72253 via svnmerge fromMark Dickinson2009-05-031-6/+6
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r72253 | mark.dickinson | 2009-05-03 21:59:48 +0100 (Sun, 03 May 2009) | 2 lines Eliminate some locale-dependent calls to isspace and tolower. ........
* Issue #5914: Add new C-API function PyOS_string_to_double, to complementMark Dickinson2009-05-031-26/+10
| | | | PyOS_double_to_string, and deprecate PyOS_ascii_strtod and PyOS_ascii_atof.
* Internal plumbing changes for float parsing:Mark Dickinson2009-04-261-57/+21
| | | | | | - check for nans and infs within PyOS_ascii_strtod - simplify parsing in PyFloat_FromString, and handle out-of-memory errors properly
* Revert accidental changes to Objects/floatobject.cMark Dickinson2009-04-181-10/+4
|
* The SSE2 detection and enabling could potentially causeMark Dickinson2009-04-181-4/+10
| | | | | | | | problems for binary distributions of Python in situations where the build machine has SSE2 but the target machine does not. Therefore, don't enable SSE2 instructions automatically on x86.
* Issue #1869 (and 4707, 5118, 5473, 1456775): use the newMark Dickinson2009-04-181-24/+142
| | | | | | | | string <-> float conversion routines to make round(x, n) correctly rounded for floats x, so that it always agrees with format(x, '.<n>f'). Also fix some other round nuisances, like round(123.456, 1-2**31) giving an integer rather than a float.
* The other half of Issue #1580: use short float repr where possible.Eric Smith2009-04-161-114/+31
| | | | | | | | | | | | | | Addresses the float -> string conversion, using David Gay's code which was added in Mark Dickinson's checkin r71663. Also addresses these, which are intertwined with the short repr changes: - Issue #5772: format(1e100, '<') produces '1e+100', not '1.0e+100' - Issue #5515: 'n' formatting with commas no longer works poorly with leading zeros. - PEP 378 Format Specifier for Thousands Separator: implemented for floats.
* Merged revisions 71627 via svnmerge fromBenjamin Peterson2009-04-151-1/+3
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r71627 | benjamin.peterson | 2009-04-15 16:26:36 -0500 (Wed, 15 Apr 2009) | 4 lines call __float__ on str subclasses #5759 tests by R. David Murray ........
* Issue #1717: rename tp_compare to tp_reserved. I'll change theMark Dickinson2009-02-021-1/+1
| | | | | type of tp_compare in a separate commit, for ease of reversion should things go wrong.
* Remove attempted long->int conversions in py3k version of ↵Mark Dickinson2009-01-171-6/+0
| | | | float.as_integer_ratio.
* Issue #4910, patch 3/3: rename nb_long to nb_reservedMark Dickinson2009-01-171-1/+1
|
* Issue 4910, patch 2 of (probably) 3: pave the way for renaming ofMark Dickinson2009-01-151-1/+1
| | | | | | | | | nb_long: remove last remaining use of nb_long (in the struct module) from the core, set nb_long slots on all builtin and extension types to 0, and remove uses of __long__ in test_complex and test_binop. Reviewed by Benjamin Peterson.
* Add missing Py_CHARMASK when calling isspace().Kristján Valur Jónsson2008-12-181-2/+2
| | | | Found by enabling runtime tests on windows, by disabling the _set_invalid_parameter_handler() fiddling.
* merge from trunkBenjamin Peterson2008-10-111-2/+2
|
* Merged revisions 66552-66553 via svnmerge fromAndrew MacIntyre2008-09-221-3/+3
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r66552 | andrew.macintyre | 2008-09-23 00:10:54 +1000 (Tue, 23 Sep 2008) | 5 lines should use macro'ed symbols not direct Part of source_os2emx.patch in issue 3868 Reviewed by Amaury Forgeot d'Arc ........ r66553 | andrew.macintyre | 2008-09-23 00:11:41 +1000 (Tue, 23 Sep 2008) | 5 lines any platform without HAVE_LOG1P should have DBL_EPSILON in <float.h> Part of source_os2emx.patch in issue 3868 Reviewed by Amaury Forgeot d'Arc ........
* Merged revisions 65964 via svnmerge fromMark Dickinson2008-08-211-5/+4
| | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r65964 | mark.dickinson | 2008-08-21 22:38:38 +0100 (Thu, 21 Aug 2008) | 7 lines issue 3633: Solaris allows fullwidth Unicode digits in isxdigit, so rewrite float.fromhex to only allow ASCII hex digits on all platforms. (Tests for this are already present, but the test_float failures on Solaris hadn't been noticed before.) Reviewed by Antoine Pitrou. ........
* fix cut and paste error in a commentGregory P. Smith2008-08-181-1/+1
|
* Rename PyUnicode_AsString -> _PyUnicode_AsString andMarc-André Lemburg2008-08-071-2/+2
| | | | | | | | | PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark them for interpreter internal use only. We'll have to rework these APIs or create new ones for the purpose of accessing the UTF-8 representation of Unicode objects for 3.1.