summaryrefslogtreecommitdiff
path: root/Objects/floatobject.c
AgeCommit message (Collapse)AuthorLines
2008-10-04Merged revisions ↵Benjamin Peterson-2/+2
66766-66767,66771-66772,66774,66776,66783-66787,66790,66793,66797 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ................ r66766 | benjamin.peterson | 2008-10-03 06:52:06 -0500 (Fri, 03 Oct 2008) | 1 line update the mac installer script ................ r66767 | andrew.kuchling | 2008-10-03 07:26:42 -0500 (Fri, 03 Oct 2008) | 1 line Docstring typo. ................ r66771 | hirokazu.yamamoto | 2008-10-03 11:18:42 -0500 (Fri, 03 Oct 2008) | 2 lines Fixed following error when DocXMLRPCServer failed. UnboundLocalError: local variable 'serv' referenced before assignment ................ r66772 | andrew.kuchling | 2008-10-03 11:29:19 -0500 (Fri, 03 Oct 2008) | 1 line Mention exception in docstring ................ r66774 | andrew.kuchling | 2008-10-03 11:42:52 -0500 (Fri, 03 Oct 2008) | 1 line Typo fix ................ r66776 | hirokazu.yamamoto | 2008-10-03 12:34:49 -0500 (Fri, 03 Oct 2008) | 2 lines Issue #1706863: Fixed "'NoneType' object has no attribute 'rfind'" error when sqlite libfile not found. ................ r66783 | andrew.kuchling | 2008-10-03 20:02:29 -0500 (Fri, 03 Oct 2008) | 1 line Use correct capitalization of NaN ................ r66784 | andrew.kuchling | 2008-10-03 20:03:42 -0500 (Fri, 03 Oct 2008) | 1 line Docstring change: Specify exception raised ................ r66785 | andrew.kuchling | 2008-10-03 20:04:24 -0500 (Fri, 03 Oct 2008) | 1 line Docstring changes: Specify exceptions raised ................ r66786 | andrew.kuchling | 2008-10-03 20:05:56 -0500 (Fri, 03 Oct 2008) | 3 lines Docstring change for *partition: use same tense as other docstrings. Hyphenate left- and right-justified. Fix 'registerd' typo ................ r66787 | andrew.kuchling | 2008-10-03 22:08:56 -0500 (Fri, 03 Oct 2008) | 1 line two corrections ................ r66790 | andrew.kuchling | 2008-10-04 11:52:01 -0500 (Sat, 04 Oct 2008) | 1 line Set svn:keywords ................ r66793 | georg.brandl | 2008-10-04 13:26:01 -0500 (Sat, 04 Oct 2008) | 2 lines #4041: don't refer to removed and outdated modules. ................ r66797 | benjamin.peterson | 2008-10-04 15:55:50 -0500 (Sat, 04 Oct 2008) | 19 lines Merged revisions 66707,66775,66782 via svnmerge from svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r66707 | benjamin.peterson | 2008-09-30 18:27:10 -0500 (Tue, 30 Sep 2008) | 1 line fix #4001: fix_imports didn't check for __init__.py before converting to relative imports ........ r66775 | collin.winter | 2008-10-03 12:08:26 -0500 (Fri, 03 Oct 2008) | 4 lines Add an alternative iterative pattern matching system that, while slower, correctly parses files that cause the faster recursive pattern matcher to fail with a recursion error. lib2to3 falls back to the iterative matcher if the recursive one fails. Fixes http://bugs.python.org/issue2532. Thanks to Nick Edds. ........ r66782 | benjamin.peterson | 2008-10-03 17:51:36 -0500 (Fri, 03 Oct 2008) | 1 line add Victor Stinner's fixer for os.getcwdu -> os.getcwd #4023 ........ ................
2008-09-22should use macro'ed symbols not directAndrew MacIntyre-3/+3
Part of source_os2emx.patch in issue 3868 Reviewed by Amaury Forgeot d'Arc
2008-09-09#3777: long(4.2) returned an int, and broke backward compatibility.Amaury Forgeot d'Arc-1/+8
the __long__ slot is allowed to return either int or long, but the behaviour of float objects should not change between 2.5 and 2.6. Reviewed by Benjamin Peterson
2008-08-21issue 3633: Solaris allows fullwidth Unicode digits in isxdigit, soMark Dickinson-5/+4
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.
2008-07-15Issue #3008: add instance method float.hex and class method float.fromhexMark Dickinson-0/+407
to convert floats to and from hexadecimal strings respectively.
2008-07-06- Issue #2862: Make int and float freelist management consistent with otherGregory P. Smith-26/+17
freelists. Changes their CompactFreeList apis into ClearFreeList apis and calls them via gc.collect().
2008-07-05Issue 3188: accept float('infinity') as well as float('inf'). ThisMark Dickinson-0/+3
makes the float constructor behave in the same way as specified by various other language standards, including C99, IEEE 754r, and the IBM Decimal standard.
2008-06-24Revert 64424, 64438, and 64439.Raymond Hettinger-65/+7
2008-06-21Fix build on FreeBSD gcc.Hye-Shik Chang-6/+6
2008-06-21Issue 3008: hex/oct/bin can show floats exactly.Raymond Hettinger-2/+60
2008-06-09This reverts r63675 based on the discussion in this thread:Gregory P. Smith-11/+11
http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
2008-05-30Refactor and clean up str.format() code (and helpers) in advance of ↵Eric Smith-18/+11
optimizations.
2008-05-26Renamed PyString to PyBytesChristian Heimes-12/+12
2008-05-09Issue #2801: fix bug in float.is_integer where ValueErrorMark Dickinson-0/+1
could be incorrectly raised. This is a backport of the Py3k fix in r62939. (Should really have been fixed in the trunk first and svnmerged into py3k.)
2008-04-18I finally got the time to update and merge Mark's and my trunk-math branch. ↵Christian Heimes-125/+81
The patch is collaborated work of Mark Dickinson and me. It was mostly done a few months ago. The patch fixes a lot of loose ends and edge cases related to operations with NaN, INF, very small values and complex math. The patch also adds acosh, asinh, atanh, log1p and copysign to all platforms. Finally it fixes differences between platforms like different results or exceptions for edge cases. Have fun :)
2008-03-28Fix compiler warning about finite() missing on Solaris.Neal Norwitz-0/+4
2008-03-27Pluralss only need one s, not 2 (intss -> ints)Neal Norwitz-1/+1
2008-03-14Issue 705836: Fix struct.pack(">f", 1e40) to behave consistentlyMark Dickinson-8/+8
across platforms: it should now raise OverflowError on all platforms. (Previously it raised OverflowError only on non IEEE 754 platforms.) Also fix the (already existing) test for this behaviour so that it actually raises TestFailed instead of just referencing it.
2008-02-17Backport of PEP 3101, Advanced String Formatting, from py3k.Eric Smith-0/+43
Highlights: - Adding PyObject_Format. - Adding string.Format class. - Adding __format__ for str, unicode, int, long, float, datetime. - Adding builtin format. - Adding ''.format and u''.format. - str/unicode fixups for formatters. The files in Objects/stringlib that implement PEP 3101 (stringdefs.h, unicodedefs.h, formatter.h, string_format.h) are identical in trunk and py3k. Any changes from here on should be made to trunk, and changes will propogate to py3k).
2008-02-04Patch #1953Christian Heimes-7/+23
I implemented the function sys._compact_freelists() and C API functions PyInt_/PyFloat_CompactFreeList() to compact the pre-allocated blocks of ints and floats. They allow the user to reduce the memory usage of a Python process that deals with lots of numbers. The patch also renames sys._cleartypecache to sys._clear_type_cache
2008-02-02Simpler solution to handling non-IEEE 754 environments.Raymond Hettinger-13/+3
2008-02-01Add protection from weirdness while scaling the mantissa to an integer.Raymond Hettinger-5/+10
2008-02-01Fix int/long typecase. Add check for non-binary floating point.Raymond Hettinger-2/+9
2008-02-01labs() takes a long for an input.Raymond Hettinger-1/+1
2008-02-01Integer ratio should return ints instead of longs whereever possible.Raymond Hettinger-2/+8
2008-02-01Issue #1996: float.as_integer_ratio() should return fraction in lowest terms.Raymond Hettinger-85/+18
2008-01-30The previous change was causing a segfault after multiple calls to ↵Christian Heimes-9/+5
Py_Initialize() and Py_Finalize().
2008-01-30Fixed some references leaks in sys.Christian Heimes-1/+0
2008-01-27Moved Rational._binary_float_to_ratio() to float.as_integer_ratio() becauseJeffrey Yasskin-0/+159
it's useful outside of rational numbers. This is my first C code that had to do anything significant. Please be more careful when looking over it.
2008-01-25Add prototypes to get the mathmodule.c to compile on OSF1 5.1 (Tru64)Neal Norwitz-0/+5
and eliminate a compiler warning in floatobject.c. There might be a better way to go about this, but it should be good enough for now.
2008-01-14Now that I've learnt about structseq objects I felt like converting ↵Christian Heimes-25/+74
sys.float_info to a structseq. It's readonly and help(sys.float_info) explains the attributes nicely.
2008-01-05Continue rolling back pep-3141 changes that changed behavior from 2.5. ThisJeffrey Yasskin-55/+3
round included: * Revert round to its 2.6 behavior (half away from 0). * Because round, floor, and ceil always return float again, it's no longer necessary to have them delegate to __xxx___, so I've ripped that out of their implementations and the Real ABC. This also helps in implementing types that work in both 2.6 and 3.0: you return int from the __xxx__ methods, and let it get enabled by the version upgrade. * Make pow(-1, .5) raise a ValueError again.
2008-01-03Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (justJeffrey Yasskin-26/+82
the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361, r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new documentation. The only significant difference is that round(x) returns a float to preserve backward-compatibility. See http://bugs.python.org/issue1689.
2007-12-19#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes-12/+12
Py_REFCNT. Macros for b/w compatibility are available.
2007-12-18Applied patch #1635: Float patch for inf and nan on Windows (and other ↵Christian Heimes-1/+49
platforms). The patch unifies float("inf") and repr(float("inf")) on all platforms.
2007-12-11The new float repr causes too much trouble and pain. I'm disabling the ↵Christian Heimes-1/+12
feature until we have sorted out the issues on all machines. 64bit machines seem to have issues and Guido has reported even worse. Guido: It's pretty bad actually -- repr(1e5) comes out as '1.0'... Ditto for repr(1eN) for most N... Both in 2.6 and in 3.0...
2007-12-10Backport of r59456:59458 from py3k to trunkChristian Heimes-2/+106
Issue #1580: New free format floating point representation based on "Floating-Point Printer Sample Code", by Robert G. Burger. For example repr(11./5) now returns '2.2' instead of '2.2000000000000002'. Thanks to noam for the patch! I had to modify doubledigits.c slightly to support X64 and IA64 machines on Windows. I also added the new file to the three project files.
2007-12-01Feature #1534Christian Heimes-0/+47
Added PyFloat_GetMax(), PyFloat_GetMin() and PyFloat_GetInfo() to the float API. Added a dictionary sys.float_info with information about the internal floating point type to the sys module.
2007-09-17Add a bunch of GIL release/acquire points in tp_print implementations and forBrett Cannon-0/+2
PyObject_Print(). Closes issue #1164.
2007-07-21PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis-14/+13
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
2007-05-03Remove dead code. This code couldn't be reached because earlier inNeal Norwitz-12/+1
the function there is another check for z != Py_None.
2006-08-23Reverting the patch that tried to fix the issue whereby x**2 raisesAlex Martelli-3/+3
OverflowError while x*x succeeds and produces infinity; apparently these inconsistencies cannot be fixed across ``all'' platforms and there's a widespread feeling that therefore ``every'' platform should keep suffering forevermore. Ah well.
2006-08-23x**2 should about equal x*x (including for a float x such that the result isAlex Martelli-3/+3
inf) but didn't; added a test to test_float to verify that, and ignored the ERANGE value for errno in the pow operation to make the new test pass (with help from Marilyn Davis at the Google Python Sprint -- thanks!).
2006-05-25Added a new macro, Py_IS_FINITE(X). On windows there is an intrinsic for ↵Kristján Valur Jónsson-5/+2
this and it is more efficient than to use !Py_IS_INFINITE(X) && !Py_IS_NAN(X). No change on other platforms
2006-04-18C++ compiler cleanup: bunch-o-casts, plus use of unsigned loop index var in ↵Skip Montanaro-1/+1
a couple places
2006-04-11More C++-compliance. Note especially listobject.c - to get C++ to accept theAnthony Baxter-5/+5
PyTypeObject structures, I had to make prototypes for the functions, and move the structure definition ahead of the functions. I'd dearly like a better way to do this - to change this would make for a massive set of changes to the codebase. There's still some warnings - this is purely to get rid of errors first.
2006-03-30Remove unnecessary casts in type object initializers.Georg Brandl-12/+12
2006-03-01Use %ld and casts to long for refcount printing, in absense of a universallyThomas Wouters-2/+6
available %zd format character. Mark with an XXX comment so we can fix this, later.
2006-02-27Revert backwards-incompatible const changes.Martin v. Löwis-1/+1
2006-02-15Merge ssize_t branch.Martin v. Löwis-2/+2