Ezio Melotti
2623a37852
Merged revisions 86596 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line
#9424 : Replace deprecated assert* methods in the Python test suite.
........
2010-11-21 13:34:58 +00:00
Brian Curtin
ee139688d3
Merged revisions 86003 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86003 | brian.curtin | 2010-10-30 19:03:45 -0500 (Sat, 30 Oct 2010) | 2 lines
Fix ResourceWarning. Use context manager to properly close file.
........
2010-10-31 00:08:27 +00:00
Benjamin Peterson
0df5a858e7
don't require the presence of __getformat__ or __setformat__; use requires_IEEE_754 globally
2010-07-02 23:05:27 +00:00
Mark Dickinson
801923681c
Merge test_strtod and test_float string-to-float conversion tests.
2010-06-20 18:50:19 +00:00
Mark Dickinson
5e0c2748fb
Use a more robust infinity check in _Py_HashDouble.
...
This fixes a test_decimal failure on FreeBSD 8.0. (modf apparently
doesn't follow C99 Annex F on FreeBSD.)
2010-04-05 18:07:51 +00:00
Mark Dickinson
876473bcc8
Check that 'd' isn't allowed as an exponent specifier in inputs to the float function.
2010-02-12 21:16:38 +00:00
Georg Brandl
a4f46e1292
Remove unused imports in test modules.
2010-02-07 17:03:15 +00:00
Ezio Melotti
aa98058cc4
use assert[Not]In where appropriate
2010-01-23 23:04:36 +00:00
Mark Dickinson
5ff4f279e6
Issue #7632 : Fix a bug in dtoa.c that could lead to incorrectly-rounded results.
2010-01-12 22:55:51 +00:00
Mark Dickinson
3194d1454c
Backport some float repr tests that were missed in issue 7117.
2010-01-08 16:53:56 +00:00
Mark Dickinson
99d652ef66
Issue #7534 : Fix handling of nans, infinities, and negative zero in **
...
operator, on IEEE 754 platforms. Thanks Marcos Donolo for original patch.
2009-12-30 12:12:23 +00:00
Eric Smith
f2bf0d2a51
Issue #4482 : Add tests for special float value formatting.
2009-12-02 17:43:06 +00:00
Eric Smith
c4ab8339e9
Issue #3382 : Make '%F' and float.__format__('F') convert results to upper case. Much of the patch came from Mark Dickinson.
2009-11-29 17:40:57 +00:00
Mark Dickinson
bce783757f
round(0, "ermintrude") succeeded instead of producing a TypeError. Fix this.
2009-11-24 10:54:58 +00:00
Mark Dickinson
bd15a06fd3
Issue #7117 , continued: Change round implementation to use the correctly-rounded
...
string <-> float conversions; this makes sure that the result of the round
operation is correctly rounded, and hence displays nicely using the new float
repr.
2009-11-18 19:33:35 +00:00
Mark Dickinson
53e9fa4eed
Test long inputs to float
2009-10-27 22:09:33 +00:00
Mark Dickinson
8568b19850
Issue #7117 : Use PyOS_string_to_double instead of PyOS_ascii_strtod in
...
floatobject.c. Also, remove limitation on length of unicode inputs to
float().
2009-10-26 21:11:20 +00:00
Benjamin Peterson
5c8da86f3a
convert usage of fail* to assert*
2009-06-30 22:57:08 +00:00
Mark Dickinson
b1d45856c2
Issue #5981 : Fix some float.fromhex bugs related to inf and nan handling.
2009-05-11 15:33:08 +00:00
Eric Smith
a985a3aee4
Issue #5920 : Changed format.__float__ and complex.__float__ to use a 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.
2009-05-05 18:26:08 +00:00
Mark Dickinson
61a0d05291
Backport some of the float formatting tests from py3k.
2009-04-29 21:57:15 +00:00
Mark Dickinson
92fcc9c991
Issue #5864 : format(1234.5, '.4') gives misleading result
...
(Backport of r72109 from py3k.)
2009-04-29 20:41:00 +00:00
Benjamin Peterson
99d36f1563
call __float__ on str subclasses #5759
...
tests by R. David Murray
2009-04-15 21:26:36 +00:00
Benjamin Peterson
a853a89dc3
fix missing module
2008-09-06 23:19:15 +00:00
Amaury Forgeot d'Arc
feb8cade4d
#3796 : A test class was not run in test_float.
...
Reviewed by Benjamin.
2008-09-06 20:53:51 +00:00
Mark Dickinson
892429b08b
Fix float.fromhex test to give additional information on failure. This
...
change is aimed at diagnosing issue 3633 (test_float fails on Solaris).
Reviewed by Benjamin Peterson
2008-08-21 20:02:24 +00:00
Mark Dickinson
62764566e8
Fix float.from_hex tests. It appears that Linux/ia64 doesn't like
...
computing 2.0**-1074 accurately. Using ldexp(1.0, -1074) should be
safer.
2008-07-15 21:55:23 +00:00
Mark Dickinson
7103aa42c0
Issue #3008 : add instance method float.hex and class method float.fromhex
...
to convert floats to and from hexadecimal strings respectively.
2008-07-15 19:08:33 +00:00
Mark Dickinson
bf9f4d8015
Issue 3188: accept float('infinity') as well as float('inf'). This
...
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-07-05 11:33:52 +00:00
Benjamin Peterson
979395b7a8
Moved testing of builtin types out of test_builtin and into type specific modules
2008-05-03 21:35:18 +00:00
Christian Heimes
6f34109384
I finally got the time to update and merge Mark's and my trunk-math branch. 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-04-18 23:13:07 +00:00
Guido van Rossum
3b83549ea0
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
...
and adds errors for -0x.
2008-01-05 00:59:59 +00:00
Christian Heimes
0a8143f646
Applied patch #1635 : Float patch for inf and nan on Windows (and other platforms).
...
The patch unifies float("inf") and repr(float("inf")) on all platforms.
2007-12-18 23:22:54 +00:00
Christian Heimes
f15c66e143
The new float repr causes too much trouble and pain. I'm disabling the 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-11 00:54:34 +00:00
Christian Heimes
284d927625
Backport of r59456:59458 from py3k to trunk
...
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-10 22:28:56 +00:00
Alex Martelli
d8672aa8a4
Fix compile.c so that it records 0.0 and -0.0 as separate constants in a code
...
object's co_consts tuple; add a test to show that the previous behavior (where
these two constants were "collapsed" into one) causes serious malfunctioning.
2007-08-22 21:14:17 +00:00
Alex Martelli
348dc88097
Reverting the patch that tried to fix the issue whereby x**2 raises
...
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-23 22:17:59 +00:00
Alex Martelli
20362a820b
x**2 should about equal x*x (including for a float x such that the result is
...
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-08-23 20:42:02 +00:00
Tim Peters
5d36a55eaa
Whitespace normalization.
2005-06-03 22:40:27 +00:00
Michael W. Hudson
ba283e2b7f
This is my patch:
...
[ 1181301 ] make float packing copy bytes when they can
which hasn't been reviewed, despite numerous threats to check it in
anyway if noone reviews it. Please read the diff on the checkin list,
at least!
The basic idea is to examine the bytes of some 'probe values' to see if
the current platform is a IEEE 754-ish platform, and if so
_PyFloat_{Pack,Unpack}{4,8} just copy bytes around.
The rest is hair for testing, and tests.
2005-05-27 15:23:20 +00:00