summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_long.py
Commit message (Collapse)AuthorAgeFilesLines
* SF bug #513866: Float/long comparison anomaly.Tim Peters2004-09-231-2/+102
| | | | | | | | | | | | | | | | | | When an integer is compared to a float now, the int isn't coerced to float. This avoids spurious overflow exceptions and insane results. This should compute correct results, without raising spurious exceptions, in all cases now -- although I expect that what happens when an int/long is compared to a NaN is still a platform accident. Note that we had potential problems here even with "short" ints, on boxes where sizeof(long)==8. There's #ifdef'ed code here to handle that, but I can't test it as intended. I tested it by changing the #ifdef to trigger on my 32-bit box instead. I suppose this is a bugfix candidate, but I won't backport it. It's long-winded (for speed) and messy (because the problem is messy). Note that this also depends on a previous 2.4 patch that introduced _Py_SwappedOp[] as an extern.
* Changed Karatsuba cutoff to match current reality.Tim Peters2004-08-301-1/+1
|
* test_float_overflow(): make shuge (added last week) a little lessGuido van Rossum2003-02-031-1/+1
| | | | | | | | | huge. On older Linux systems, the C library's strtod() apparently gives up before seeing the end of the string when it sees so many digits that it thinks the result must be Infinity. (It is wrong, BTW -- there could be an "e-10000" hiding behind 10,000 digits.) The shorter shuge still tests what it's testing, without relying on strtod() doing a super job.
* Fix SF bug# 676155, RuntimeWarning with tp_compareNeal Norwitz2003-01-281-2/+4
| | | | Check return value of PyLong_AsDouble(), it can return an error.
* Change int() so that passing a string, unicode, float or long argumentWalter Dörwald2002-11-191-10/+14
| | | | | | | that is outside the integer range no longer raises OverflowError, but returns a long object instead. This fixes SF bug http://www.python.org/sf/635115
* Added a test specifically to tickle Karatsuba; it costs no appreciableTim Peters2002-08-131-0/+26
| | | | runtime.
* test_division(): Added one larger digits value, to ensure that theTim Peters2002-08-131-1/+2
| | | | "lopsided Karatsuba" driver also gets some exercise.
* Machines-- and Python --are a lot faster in relevant ways since thisTim Peters2002-08-131-3/+5
| | | | | | test was written. So boosted the number of "digits" this generates, and also beefed up the "* / divmod" test to tickle numbers big enough to trigger the Karatsuba algorithm. It takes about 2 seconds now on my box.
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+1
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* Format strings (tuples,) appropriatelyNeal Norwitz2002-04-011-1/+1
|
* Return reasonable results for math.log(long) and math.log10(long) (we wereTim Peters2001-09-051-3/+37
| | | | | | getting Infs, NaNs, or nonsense in 2.1 and before; in yesterday's CVS we were getting OverflowError; but these functions always make good sense for positive arguments, no matter how large).
* Revert one of the "division fixes" in test_long. It intends to try bothTim Peters2001-09-041-2/+2
| | | | | | "/" and "//", and doesn't really care what they *mean*, just that both are tried (and that, whatever they mean, they act similarly for int and long arguments).
* The first batch of changes recommended by the fixdiv tool. These areGuido van Rossum2001-09-041-5/+5
| | | | | mostly changes of / operators into //. Once or twice I did more or less than recommended.
* Whitespace normalization.Tim Peters2001-09-041-1/+1
|
* Raise OverflowError when appropriate on long->float conversion. Most ofTim Peters2001-09-041-0/+37
| | | | | | | the fiddling is simply due to that no caller of PyLong_AsDouble ever checked for failure (so that's fixing old bugs). PyLong_AsDouble is much faster for big inputs now too, but that's more of a happy consequence than a design goal.
* New restriction on pow(x, y, z): If z is not None, x and y must be ofTim Peters2001-09-031-4/+13
| | | | | integer types, and y must be >= 0. See discussion at http://sf.net/tracker/index.php?func=detail&aid=457066&group_id=5470&atid=105470
* Add a test for the new // operator too.Tim Peters2001-08-231-0/+4
|
* SF bug [#454456] int overflow code needs tests.Tim Peters2001-08-231-0/+61
| | | | | Added tests for boundary cases in magical PEP 237 int->long auto-overflow, but nothing here addresses the rest of the bug report so left it open.
* Remove test_long's expected-output file.Tim Peters2001-08-231-4/+8
|
* This patch removes all uses of "assert" in the regression test suiteMarc-André Lemburg2001-01-171-4/+4
| | | | | | | and replaces them with a new API verify(). As a result the regression suite will also perform its tests in optimization mode. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
* Make reindent.py happy (convert everything to 4-space indents!).Fred Drake2000-10-231-1/+0
|
* Christian Tismer: added test to ensure that multiplication commutes.Guido van Rossum2000-04-101-0/+2
| | | | | | [The test is in a slightly odd place, in test_division_2; but it exercises the recent change to long_mult(), and that's all we really ask for. --GvR]
* Revise tests to support str(<long int object>) not appending "L".Fred Drake1999-12-231-2/+8
|
* New test_long.py from Tim Peters.Guido van Rossum1998-10-021-11/+124
|
* Add Tim Peters' test for long intsGuido van Rossum1998-08-131-0/+139