Commit Graph

84 Commits

Author SHA1 Message Date
Mark Dickinson a0ce375e10 bpo-29962: add math.remainder (#950)
* Implement math.remainder.

* Fix markup for arguments; use double spaces after period.

* Mark up function reference in what's new entry.

* Add comment explaining the calculation in the final branch.

* Fix out-of-order entry in whatsnew.

* Add comment explaining why it's good enough to compare m with c, in spite of possible rounding error.
2017-04-05 18:34:27 +01:00
Mark Dickinson 5e65cd39df Issue #29282: Backed out changeset b33012ef1417 2017-01-21 13:10:52 +00:00
Mark Dickinson d1b230e48b Issue #29282: add fused multiply-add function, math.fma. 2017-01-21 12:35:30 +00:00
Mark Dickinson 31ba1c3de8 Issue #27427: Additional tests for the math module. Thanks Francisco Couzo. 2016-09-04 12:29:14 +01:00
Mark Dickinson 85746542ea Issue #27953: skip failing math and cmath tests for tan on OS X 10.4. 2016-09-04 09:58:51 +01:00
Mark Dickinson 96f774d824 Issue #26040: Improve test_math and test_cmath coverage and rigour. Thanks Jeff Allen. 2016-09-03 19:30:22 +01:00
Guido van Rossum 0a891d70de Issue #12345: Add mathemathcal constant tau to math and cmath.
Patch by Lisa Roach. See also PEP 628.
2016-08-15 09:12:52 -07:00
Martin Panter 8bde911115 Issue #27626: Merge spelling fixes from 3.5 2016-07-28 01:30:58 +00:00
Martin Panter eb9957065a Issue #27626: Spelling fixes in docs, comments and internal names
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Serhiy Storchaka e437a10d15 Issue #23277: Remove unused imports in tests. 2016-04-24 21:41:02 +03:00
Tal Einat d5519ed7f4 Issue #19543: Implementation of isclose as per PEP 485
For details, see:
PEP 0485 -- A Function for testing approximate equality

Functions added: math.isclose() and cmath.isclose().

Original code by Chris Barker. Patch by Tal Einat.
2015-05-31 22:05:00 +03:00
Serhiy Storchaka 48e47aaa28 Issue #22486: Added the math.gcd() function. The fractions.gcd() function now is
deprecated.  Based on patch by Mark Dickinson.
2015-05-13 00:19:51 +03:00
Mark Dickinson a5d0c7c2fd Issue #23185: add math.inf and math.nan constants. 2015-01-11 11:55:29 +00:00
Mark Dickinson 5990d2864c Issue #20539: Improve math.factorial error messages and types for large inputs.
- Better message for the OverflowError in large positive inputs.
- Changed exception type from OverflowError to ValueError for large negative inputs.
2014-04-10 09:29:39 -04:00
Serhiy Storchaka 43767638a9 Issue #18702: All skipped tests now reported as skipped. 2013-11-03 21:31:38 +02:00
Victor Stinner ebbbdafd87 (Merge 3.2) Close #12230: Mac OS X Tiger (10.4) has a kernel bug: sometimes,
the file descriptor of a pipe closed in the parent process is valid in the
child process according to fstat(), but the mode of the file descriptor is
invalid, and read or write raise an error.

test.support.requires_mac_ver() is now a decorator, as suggested by Ezio
Melotti, and its docstring is fixed (linux_version => mac_ver).
2011-06-01 13:19:07 +02:00
Victor Stinner fce9233e93 test.support: add requires_mac_ver() function
Add also linux_version() to __all__.
2011-06-01 12:28:04 +02:00
Victor Stinner cd9dd37974 Issue #11888: skip some log2 tests on Mac OS X Tiger
System log2() is not accurate for exact power of 2.
2011-05-10 23:40:17 +02:00
Mark Dickinson df77e3d4a0 Issue #11188: In log2 tests, create powers of 2 using ldexp(1, n) instead of the less reliable 2.0**n. 2011-05-09 14:02:45 +01:00
Victor Stinner fa0e3d52d6 Issue #11888: Add log2 function to math module. Patch written by Mark
Dickinson.
2011-05-09 01:01:09 +02:00
Mark Dickinson 5bc7a44477 test_math.py: Use correct signs on zeros for expected fmod results. 2011-05-03 21:13:40 +01:00
Mark Dickinson 0cc28b7a34 Remove an unused import and an unused local definition from test_math.py. 2011-05-03 21:02:51 +01:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
Ezio Melotti 13925008dc #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 11:05:33 +02:00
Eric Smith f24a0d90a9 Issue #10624: Move requires_IEEE_754 into test.support. I'll fix up other uses of it shortly. 2010-12-04 13:32:18 +00:00
Ezio Melotti 19f2aeba67 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 01:30:29 +00:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Victor Stinner be3da38e0a Issue #10337: skip tests of tanh() sign in test_math and test_cmath if tanh()
doesn't preserve the zero sign (if TANH_PRESERVES_ZERO_SIGN define is 0).
2010-11-07 14:14:27 +00:00
Mark Dickinson c60371748b Issue #9599: Further accuracy tweaks to loghelper. For an integer n that's small enough to be converted to a float without overflow, log(n) is now computed as log(float(n)), and similarly for log10. 2010-09-29 19:06:36 +00:00
Mark Dickinson 8e0c996873 Issue #9165: Add math.isfinite and cmath.isfinite. 2010-07-11 17:38:24 +00:00
Mark Dickinson be64d95169 Issue #9186: log1p(-1.0) should raise ValueError, not OverflowError. 2010-07-07 16:21:29 +00:00
Benjamin Peterson 97c694b90b looking up on the type is correct, so this isn't an XXX 2010-07-05 17:11:05 +00:00
Mark Dickinson bcdf9da265 Merged revisions 81967 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81967 | mark.dickinson | 2010-06-13 11:50:29 +0100 (Sun, 13 Jun 2010) | 4 lines

  Issue #8986: erfc was raising OverflowError on Linux for arguments in
  the (approximate) range (-27.3, 30.0), as a result of an escaped errno
  value.
........
2010-06-13 10:52:38 +00:00
Mark Dickinson 4c8a9a2df3 Issue #8692: Improve performance of math.factorial:
(1) use a different algorithm that roughly halves the total number of
    multiplications required and results in more balanced multiplications
(2) use a lookup table for small arguments
(3) fast accumulation of products in C integer arithmetic rather than
    PyLong arithmetic when possible.

Typical speedup, from unscientific testing on a 64-bit laptop, is 4.5x
to 6.5x for arguments in the range 100 - 10000.

Patch by Daniel Stutzbach; extensive reviews by Alexander Belopolsky.
2010-05-15 17:02:38 +00:00
Mark Dickinson 3d9fa6da93 Merged revisions 81127 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81127 | mark.dickinson | 2010-05-12 20:54:51 +0100 (Wed, 12 May 2010) | 9 lines

  Merged revisions 81126 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r81126 | mark.dickinson | 2010-05-12 20:53:36 +0100 (Wed, 12 May 2010) | 1 line

    Fix unused variable in test_factorial.
  ........
................
2010-05-12 19:57:07 +00:00
Mark Dickinson 91f021fb70 Merged revisions 81126 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81126 | mark.dickinson | 2010-05-12 20:53:36 +0100 (Wed, 12 May 2010) | 1 line

  Fix unused variable in test_factorial.
........
2010-05-12 19:54:51 +00:00
Mark Dickinson f57325392f Merged revisions 78045 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78045 | mark.dickinson | 2010-02-06 23:16:50 +0000 (Sat, 06 Feb 2010) | 9 lines

  Merged revisions 78041 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78041 | mark.dickinson | 2010-02-06 23:11:25 +0000 (Sat, 06 Feb 2010) | 1 line

    testCopysign was defined twice in test_math;  combine the definitions
  ........
................
2010-02-06 23:18:37 +00:00
Mark Dickinson 06b59e0c4b Merged revisions 78041 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78041 | mark.dickinson | 2010-02-06 23:11:25 +0000 (Sat, 06 Feb 2010) | 1 line

  testCopysign was defined twice in test_math;  combine the definitions
........
2010-02-06 23:16:50 +00:00
Mark Dickinson 664b511c0a Merged revisions 76861 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76861 | mark.dickinson | 2009-12-16 20:13:40 +0000 (Wed, 16 Dec 2009) | 3 lines

  Issue #3366: Add expm1 function to math module.  Thanks Eric Smith for
  testing on Windows.
........
2009-12-16 20:23:42 +00:00
Mark Dickinson 05d2e08401 Merged revisions 76755 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76755 | mark.dickinson | 2009-12-11 17:29:33 +0000 (Fri, 11 Dec 2009) | 2 lines

  Issue #3366:  Add lgamma function to math module.
........
2009-12-11 20:17:17 +00:00
Mark Dickinson d412ab5260 Merged revisions 75454 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75454 | mark.dickinson | 2009-10-17 08:06:37 +0100 (Sat, 17 Oct 2009) | 1 line

  test_math ulp computation was wrong on big-endian systems
........
2009-10-17 07:10:00 +00:00
Mark Dickinson 2d53bdecd8 Merged revisions 75157 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75157 | mark.dickinson | 2009-09-30 17:58:01 +0100 (Wed, 30 Sep 2009) | 1 line

  Fix buggy accuracy test
........
2009-09-30 17:47:54 +00:00
Mark Dickinson 12c4bdb0e8 Merged revisions 75117 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75117 | mark.dickinson | 2009-09-28 19:54:55 +0100 (Mon, 28 Sep 2009) | 3 lines

  Issue #3366:  Add gamma function to math module.
  (lgamma, erf and erfc to follow).
........
2009-09-28 19:21:11 +00:00
Mark Dickinson 63566239f7 Merged revisions 74925 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74925 | mark.dickinson | 2009-09-18 22:01:50 +0100 (Fri, 18 Sep 2009) | 2 lines

  Use skipUnless to skip math module tests on non-IEEE 754 platforms.
........
2009-09-18 21:04:19 +00:00
Georg Brandl ab91fdef1f Merged revisions 73715 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r73715 | benjamin.peterson | 2009-07-01 01:06:06 +0200 (Mi, 01 Jul 2009) | 1 line

  convert old fail* assertions to assert*
........
2009-08-13 08:51:18 +00:00
Benjamin Peterson c9c0f201fe convert old fail* assertions to assert* 2009-06-30 23:06:06 +00:00
Mark Dickinson 5c56708f68 Merged revisions 71837-71838 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71837 | mark.dickinson | 2009-04-24 17:34:14 +0100 (Fri, 24 Apr 2009) | 4 lines

  Issue #5593: Use more robust test for double-rounding in test_fsum.
  While we're at it, use new unittest.skipUnless decorator to
  implement skipping for that test.
........
  r71838 | mark.dickinson | 2009-04-24 17:37:22 +0100 (Fri, 24 Apr 2009) | 2 lines

  Remove unnecessary double negative
........
2009-04-24 16:39:07 +00:00
Mark Dickinson aa7633ab94 Merged revisions 65258,65292,65299,65308-65309,65315,65326 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65258 | mark.dickinson | 2008-07-27 08:15:29 +0100 (Sun, 27 Jul 2008) | 4 lines

  Remove math.sum tests related to overflow, special values, and behaviour
  near the extremes of the floating-point range.  (The behaviour of math.sum
  should be regarded as undefined in these cases.)
........
  r65292 | mark.dickinson | 2008-07-29 19:45:38 +0100 (Tue, 29 Jul 2008) | 4 lines

  More modifications to tests for math.sum:  replace the Python
  version of msum by a version using a different algorithm, and
  use the new float.fromhex method to specify test results exactly.
........
  r65299 | mark.dickinson | 2008-07-30 13:01:41 +0100 (Wed, 30 Jul 2008) | 5 lines

  Fix special-value handling for math.sum.
  Also minor cleanups to the code: fix tabbing, remove
  trailing whitespace, and reformat to fit into 80
  columns.
........
  r65308 | mark.dickinson | 2008-07-30 17:20:10 +0100 (Wed, 30 Jul 2008) | 2 lines

  Rename math.sum to math.fsum
........
  r65309 | mark.dickinson | 2008-07-30 17:25:16 +0100 (Wed, 30 Jul 2008) | 3 lines

  Replace math.sum with math.fsum in a couple of comments
  that were missed by r65308
........
  r65315 | mark.dickinson | 2008-07-30 21:23:15 +0100 (Wed, 30 Jul 2008) | 2 lines

  Add note about problems with math.fsum on x86 hardware.
........
  r65326 | mark.dickinson | 2008-07-31 15:48:32 +0100 (Thu, 31 Jul 2008) | 2 lines

  Rename testSum to testFsum and move it to proper place in test_math.py
........
2008-08-01 08:16:13 +00:00
Georg Brandl c28e1fa71f Merged revisions 64002-64003,64012,64036-64037,64047,64050-64052,64054-64055,64066,64071 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64002 | travis.oliphant | 2008-06-07 00:33:21 +0200 (Sat, 07 Jun 2008) | 1 line

  Add long double check support to configure test.
........
  r64003 | travis.oliphant | 2008-06-07 00:39:47 +0200 (Sat, 07 Jun 2008) | 1 line

  Remove locking part of new buffer protocol.
........
  r64012 | facundo.batista | 2008-06-07 15:36:36 +0200 (Sat, 07 Jun 2008) | 4 lines


  Finished bug #2451.  Fixed the retrying part to make it
  more robust.
........
  r64036 | georg.brandl | 2008-06-08 10:54:40 +0200 (Sun, 08 Jun 2008) | 2 lines

  #3028: tokenize passes the physical line.
........
  r64037 | georg.brandl | 2008-06-08 10:59:38 +0200 (Sun, 08 Jun 2008) | 2 lines

  Argh, I read it wrong. Reverted 64036 and added a clarifying remark.
........
  r64047 | raymond.hettinger | 2008-06-09 03:28:30 +0200 (Mon, 09 Jun 2008) | 1 line

  Issue3065:  Fixed pickling of named tuples.  Added tests.
........
  r64050 | raymond.hettinger | 2008-06-09 08:54:45 +0200 (Mon, 09 Jun 2008) | 1 line

  Issue #2138: Add math.factorial().
........
  r64051 | raymond.hettinger | 2008-06-09 10:33:37 +0200 (Mon, 09 Jun 2008) | 1 line

  Let set.union() and set.update() accept multiple inputs.
........
  r64052 | raymond.hettinger | 2008-06-09 11:29:17 +0200 (Mon, 09 Jun 2008) | 1 line

  Address double-rounding scenarios by setting all variables to long doubles.
........
  r64054 | raymond.hettinger | 2008-06-09 13:24:47 +0200 (Mon, 09 Jun 2008) | 1 line

  Unhappy buildbots.  Revert 64052.  Long doubles have unexpected effects on some builds.
........
  r64055 | raymond.hettinger | 2008-06-09 15:07:27 +0200 (Mon, 09 Jun 2008) | 1 line

  Let set.intersection() and set.intersection_update() take multiple input arguments.
........
  r64066 | robert.schuppenies | 2008-06-10 12:10:31 +0200 (Tue, 10 Jun 2008) | 2 lines

  Issue 3048: Fixed sys.getsizeof for unicode objects.
........
  r64071 | thomas.heller | 2008-06-10 16:07:12 +0200 (Tue, 10 Jun 2008) | 3 lines

  NEWS entry for:
  Add an optional 'offset' parameter to byref, defaulting to zero.
........
2008-06-10 19:20:26 +00:00
Georg Brandl f78e02b798 Merged revisions 63562,63570,63728,63734,63784,63788,63802,63817,63827,63839,63887,63975,63998 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r63562 | martin.v.loewis | 2008-05-23 17:06:50 +0200 (Fri, 23 May 2008) | 2 lines

  Patch #1722225: Support QNX 6.
........
  r63570 | trent.nelson | 2008-05-23 22:33:14 +0200 (Fri, 23 May 2008) | 1 line

  Introduce a user macro named $(externalsDir), which should point to the root directory of where all the external sources should live.  Developers can change this value if their external sources live elsewhere.  The default of '..\..' matches the current status quo.
........
  r63728 | gregory.p.smith | 2008-05-26 23:16:34 +0200 (Mon, 26 May 2008) | 4 lines

  Fix issue2589: there was a potential integer overflow leading to
  memory corruption on esoteric platforms and incorrect behavior on
  normal platforms.
........
  r63734 | gregory.p.smith | 2008-05-27 00:07:28 +0200 (Tue, 27 May 2008) | 3 lines

  Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is
  passed in.  (The assert won't prevent this in non-debug builds).
........
  r63784 | raymond.hettinger | 2008-05-29 10:38:23 +0200 (Thu, 29 May 2008) | 1 line

  Fix two typos.
........
  r63788 | facundo.batista | 2008-05-29 18:39:26 +0200 (Thu, 29 May 2008) | 6 lines


  Fixed the semantic of timeout for socket.create_connection and
  all the upper level libraries that use it, including urllib2.
  Added and fixed some tests, and changed docs correspondingly.
  Thanks to John J Lee for the patch and the pusing, :)
........
  r63802 | mark.dickinson | 2008-05-30 04:46:53 +0200 (Fri, 30 May 2008) | 2 lines

  Fix typo in testSum
........
  r63817 | raymond.hettinger | 2008-05-30 20:20:50 +0200 (Fri, 30 May 2008) | 8 lines

  * Mark intermedidate computes values (hi, lo, yr) as volatile.
  * Expand comments.
  * Swap variable names in the sum_exact code so that x and y
    are consistently chosen as the larger and smaller magnitude
    values respectively.
........
  r63827 | raymond.hettinger | 2008-05-31 05:24:31 +0200 (Sat, 31 May 2008) | 1 line

  Implement heapq in terms of less-than (to match list.sort()).
........
  r63839 | gerhard.haering | 2008-05-31 23:33:27 +0200 (Sat, 31 May 2008) | 2 lines

  Fixed rowcount for SELECT statements. They're -1 now (again), for better DB-API 2.0 compliance.
........
  r63887 | gregory.p.smith | 2008-06-02 06:05:52 +0200 (Mon, 02 Jun 2008) | 4 lines

  Fix issue 2782: be less strict about the format string type in strftime.
  Accept unicode and anything else ParseTuple "s#" can deal with.  This
  matches the time.strftime behavior.
........
  r63975 | neal.norwitz | 2008-06-06 06:47:01 +0200 (Fri, 06 Jun 2008) | 3 lines

  Aldo Cortesi confirmed this is still needed for OpenBSD 4.2 and 4.3.
  (I didn't regen configure, since I don't have a working autoconf.)
........
  r63998 | raymond.hettinger | 2008-06-06 23:47:51 +0200 (Fri, 06 Jun 2008) | 1 line

  Issue 3501: Make heapq support both __le__ and __lt__.
........
2008-06-10 17:40:04 +00:00