Commit graph

71 commits

Author SHA1 Message Date
Christian Heimes fa26245a1c
bpo-45548: Remove _math.c workarounds for pre-C99 libm (GH-29179)
The :mod:`math` and :mod:`cmath` implementation now require a C99 compatible
``libm`` and no longer ship with workarounds for missing acosh, asinh,
expm1, and log1p functions.

The changeset also removes ``_math.c`` and moves the last remaining
workaround into ``_math.h``. This simplifies static builds with
``Modules/Setup`` and resolves symbol conflicts.

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
Co-authored-by: Brett Cannon <brett@python.org>
Signed-off-by: Christian Heimes <christian@python.org>
2021-10-25 01:25:27 -07:00
Christian Heimes 03e9f5dc75
bpo-43974: Move Py_BUILD_CORE_MODULE into module code (GH-29157)
setup.py no longer defines Py_BUILD_CORE_MODULE. Instead every
module defines the macro before #include "Python.h" unless
Py_BUILD_CORE_BUILTIN is already defined.

Py_BUILD_CORE_BUILTIN is defined for every module that is built by
Modules/Setup.

The PR also simplifies Modules/Setup. Makefile and makesetup
already define Py_BUILD_CORE_BUILTIN and include Modules/internal
for us.

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-22 15:36:28 +02:00
Mohamed Koubaa f76d894dc5
bpo-1635741: Port cmath to multi-phase init (PEP 489) (GH-22165) 2020-09-10 16:09:04 +02:00
Victor Stinner e9e7d284c4
bpo-35081: Move dtoa.h header to the internal C API (GH-18489)
Move the dtoa.h header file to the internal C API as pycore_dtoa.h:
it only contains private functions (prefixed by "_Py").

The math and cmath modules must now be compiled with the
Py_BUILD_CORE macro defined.
2020-02-12 22:54:42 +01:00
Victor Stinner be143ec996
bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)
The PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros are empty:
they have been doing nothing for the last year  (since commit
735ae8d139), so stop using them.
2019-11-20 02:51:30 +01:00
Serhiy Storchaka 279f44678c
bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933)
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values
(like in the optional third parameter of getattr). "None" should be used if None is accepted
as argument and passing None has the same effect as not passing the argument at all.
2019-09-14 12:24:05 +03:00
Ned Batchelder 6faad355db bpo-36908: 'This module is always available' isn't helpful. (#13297)
Makes the documentation of math and cmath module
more helpful for the beginners.
2019-05-17 15:29:13 +05:30
Mark Dickinson 84e6311dee Issue 23229: add cmath.inf, cmath.nan, cmath.infj and cmath.nanj. 2016-08-29 13:56:58 +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
Serhiy Storchaka 1a2b24f02d Issue #27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic.  Patch by Petr Viktorin.
2016-07-07 17:35:15 +03:00
Serhiy Storchaka ebe95fdabb Issue #26305: Argument Clinic now escapes braces. No need to double them. 2016-06-09 16:02:15 +03:00
Antoine Pitrou a72f0cdaea Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar(). 2015-06-23 14:38:13 +02:00
Antoine Pitrou 6bc217dd3d Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar(). 2015-06-23 14:31:11 +02: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 1009bf18b3 Issue #23501: Argumen Clinic now generates code into separate files by default. 2015-04-03 23:53:51 +03:00
Serhiy Storchaka 79d8f3f123 Regenerated Argument Clinic checksums. 2015-02-20 12:46:11 +02:00
Mark Dickinson cc8617b93a Issue #21092: Merge from 3.4. 2015-01-11 13:22:44 +00:00
Mark Dickinson dfe0b2326b Issue #21902: Replace incorrect 'hyperbolic arc sine' (etc.) with 'inverse hyperbolic sine' (etc.). Remove meaningless reference to radians. 2015-01-11 13:08:05 +00:00
Brett Cannon b0fc490307 Issue #20152: Convert the cmath module to Argument Clinic. 2014-10-14 17:37:02 -04:00
Antoine Pitrou de08cb60fd Fix compilation failure (followup to #21803) 2014-07-07 19:08:47 -04:00
Brett Cannon 1088d98899 The function name for cmath.isinf in PyArg_ParseTuple() was wrong. 2014-01-31 12:04:36 -05:00
Mark Dickinson 58ceecfe5a Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect(0.0,-0.0) results. 2013-07-20 17:59:13 +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
Mark Dickinson 8e0c996873 Issue #9165: Add math.isfinite and cmath.isfinite. 2010-07-11 17:38:24 +00:00
Antoine Pitrou 7f14f0d8a0 Recorded merge of revisions 81032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines

  Recorded merge of revisions 81029 via svnmerge from
  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.
  ........
................
2010-05-09 16:14:21 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
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.
........
2010-05-09 15:52:27 +00:00
Mark Dickinson f371859a4f Merged revisions 76978 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76978 | mark.dickinson | 2009-12-21 15:22:00 +0000 (Mon, 21 Dec 2009) | 3 lines

  Issue #7518:  Move substitute definitions of C99 math functions from
  pymath.c to Modules/_math.c.
........
2009-12-21 15:27:41 +00:00
Mark Dickinson 216dc7b70b Merged revisions 74305 via svnmerge from
svn+ssh://pythondev@www.python.org/python/branches/py3k

................
  r74305 | mark.dickinson | 2009-08-04 20:25:12 +0100 (Tue, 04 Aug 2009) | 9 lines

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

  ........
    r74303 | mark.dickinson | 2009-08-04 20:22:35 +0100 (Tue, 04 Aug 2009) | 2 lines

    Issue #6644:  Fix compile error on AIX.
  ........
................
2009-08-04 19:26:17 +00:00
Mark Dickinson e5842c1f14 Merged revisions 74303 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74303 | mark.dickinson | 2009-08-04 20:22:35 +0100 (Tue, 04 Aug 2009) | 2 lines

  Issue #6644:  Fix compile error on AIX.
........
2009-08-04 19:25:12 +00:00
Mark Dickinson 1bd2e29d82 Merged revisions 70062 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70062 | mark.dickinson | 2009-02-28 15:50:40 +0000 (Sat, 28 Feb 2009) | 2 lines

  Issue #5393: typo in cmath.cos and cmath.cosh docstring
........
2009-02-28 15:53:24 +00:00
Georg Brandl 86b2fb9d77 Merged revisions 64623,64640,64665,64687,64689-64690,64719,64721,64735,64742,64744-64746,64756-64761,64767-64769,64771-64772,64774-64775,64788,64793,64835-64836 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64623 | benjamin.peterson | 2008-07-01 21:51:54 +0200 (Tue, 01 Jul 2008) | 1 line

  write a short little section for multiprocessing; it still needs help
........
  r64640 | georg.brandl | 2008-07-01 22:56:03 +0200 (Tue, 01 Jul 2008) | 2 lines

  Add a comment about incref'ing w.
........
  r64665 | jesse.noller | 2008-07-02 18:56:51 +0200 (Wed, 02 Jul 2008) | 1 line

  Add #!/usr/bin/env python for ben
........
  r64687 | andrew.kuchling | 2008-07-03 14:50:03 +0200 (Thu, 03 Jul 2008) | 1 line

  Tweak wording
........
  r64689 | benjamin.peterson | 2008-07-03 14:57:35 +0200 (Thu, 03 Jul 2008) | 1 line

  lowercase glossary term
........
  r64690 | benjamin.peterson | 2008-07-03 15:01:17 +0200 (Thu, 03 Jul 2008) | 1 line

  let the term be linked
........
  r64719 | raymond.hettinger | 2008-07-05 04:11:55 +0200 (Sat, 05 Jul 2008) | 1 line

  Update comment on prediction macros.
........
  r64721 | georg.brandl | 2008-07-05 12:07:18 +0200 (Sat, 05 Jul 2008) | 2 lines

  Fix tabs.
........
  r64735 | mark.dickinson | 2008-07-05 17:25:48 +0200 (Sat, 05 Jul 2008) | 3 lines

  Minor rewrite of cmath_log to work around a Sun compiler bug.  See issue
  #3168.
........
  r64742 | benjamin.peterson | 2008-07-05 18:29:38 +0200 (Sat, 05 Jul 2008) | 1 line

  make regrtest aware of the lib2to3 resource
........
  r64744 | georg.brandl | 2008-07-05 18:43:45 +0200 (Sat, 05 Jul 2008) | 2 lines

  Keep below 80 chars.
........
  r64745 | facundo.batista | 2008-07-05 21:19:50 +0200 (Sat, 05 Jul 2008) | 3 lines


  Issue 3289.  Removed two lines that ended doing nothing.
........
  r64746 | facundo.batista | 2008-07-05 22:39:59 +0200 (Sat, 05 Jul 2008) | 4 lines


  Issue #3239. Differentiate the ascii call from the curses one and
  the builtin one.
........
  r64756 | gregory.p.smith | 2008-07-06 09:16:40 +0200 (Sun, 06 Jul 2008) | 3 lines

  - Issue #2113: Fix error in subprocess.Popen if the select system call is
    interrupted by a signal.
........
  r64757 | benjamin.peterson | 2008-07-06 14:39:09 +0200 (Sun, 06 Jul 2008) | 1 line

  remove test_compact_freelists from test_sys
........
  r64758 | gregory.p.smith | 2008-07-06 19:06:29 +0200 (Sun, 06 Jul 2008) | 2 lines

  fix issue3304 - remove an incorrect PyMem_Free in fileio_init
........
  r64759 | georg.brandl | 2008-07-06 19:36:20 +0200 (Sun, 06 Jul 2008) | 2 lines

  Fix opensearch template.
........
  r64760 | andrew.kuchling | 2008-07-06 19:43:16 +0200 (Sun, 06 Jul 2008) | 1 line

  Wording fix
........
  r64761 | andrew.kuchling | 2008-07-06 19:44:17 +0200 (Sun, 06 Jul 2008) | 1 line

  Add two items; rewrap paragraph
........
  r64767 | gregory.p.smith | 2008-07-07 06:31:58 +0200 (Mon, 07 Jul 2008) | 4 lines

  - Issue #3309: Fix bz2.BZFile itererator to release its internal lock
    properly when raising an exception due to the bz2file being closed.
    Prevents a deadlock.
........
  r64768 | josiah.carlson | 2008-07-07 06:51:46 +0200 (Mon, 07 Jul 2008) | 2 lines

  Fixed bugs 760475, 953599, and 1519.
........
  r64769 | gregory.p.smith | 2008-07-07 06:54:31 +0200 (Mon, 07 Jul 2008) | 2 lines

  Add commented out #_sha256 and #_sha512 lines per issue 3183.
........
  r64771 | gregory.p.smith | 2008-07-07 07:09:12 +0200 (Mon, 07 Jul 2008) | 4 lines

  - Issue #3094: httplib.HTTPSConnection Host: headers no longer include the
    redundant ":443" port number designation when the connection is using the
    default https port (443).
........
  r64772 | skip.montanaro | 2008-07-07 13:16:14 +0200 (Mon, 07 Jul 2008) | 2 lines

  Correct grammar.
........
  r64774 | andrew.kuchling | 2008-07-07 18:51:09 +0200 (Mon, 07 Jul 2008) | 1 line

  Fix example to match text
........
  r64775 | facundo.batista | 2008-07-07 19:02:59 +0200 (Mon, 07 Jul 2008) | 3 lines


  Issue 3306. Better control for a lenght in findmax() function.
........
  r64788 | georg.brandl | 2008-07-08 09:05:23 +0200 (Tue, 08 Jul 2008) | 2 lines

  Add missing ABCs to list.
........
  r64793 | nick.coghlan | 2008-07-08 16:21:42 +0200 (Tue, 08 Jul 2008) | 1 line

  Add missing NEWS and ACK entries for r64791
........
  r64835 | raymond.hettinger | 2008-07-10 11:31:08 +0200 (Thu, 10 Jul 2008) | 1 line

  Issue 3287: Raise correct exception for float inputs.
........
  r64836 | raymond.hettinger | 2008-07-10 12:28:41 +0200 (Thu, 10 Jul 2008) | 1 line

  Use operator.index() instead of n.__index__().
........
2008-07-16 03:43:04 +00:00
Martin v. Löwis 1a21451b1d Implement PEP 3121: new module initialization and finalization API. 2008-06-11 05:26:20 +00:00
Alexandre Vassalotti bee325387b Merged revisions 63361-63373,63375,63377-63380 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r63361 | alexandre.vassalotti | 2008-05-16 03:14:08 -0400 (Fri, 16 May 2008) | 2 lines

  Rename the test file of reprlib.
........
  r63364 | georg.brandl | 2008-05-16 05:34:48 -0400 (Fri, 16 May 2008) | 2 lines

  Make generator repr consistent with function and code object repr.
........
  r63365 | georg.brandl | 2008-05-16 05:47:29 -0400 (Fri, 16 May 2008) | 2 lines

  #2869: remove parameter from signature.
........
  r63366 | christian.heimes | 2008-05-16 06:23:31 -0400 (Fri, 16 May 2008) | 1 line

  Fixed #2870: cmathmodule.c compile error
........
  r63367 | christian.heimes | 2008-05-16 07:28:56 -0400 (Fri, 16 May 2008) | 1 line

  Following Amaury's advice
........
  r63368 | georg.brandl | 2008-05-16 09:10:15 -0400 (Fri, 16 May 2008) | 2 lines

  #2890: support os.O_ASYNC and fcntl.FASYNC.
........
  r63369 | georg.brandl | 2008-05-16 09:18:50 -0400 (Fri, 16 May 2008) | 2 lines

  #2845: fix copy2's docs.
........
  r63370 | georg.brandl | 2008-05-16 09:24:29 -0400 (Fri, 16 May 2008) | 2 lines

  Don't allow keyword arguments to reversed().
........
  r63373 | georg.brandl | 2008-05-16 09:41:26 -0400 (Fri, 16 May 2008) | 2 lines

  Document O_ASYNC addition.
........
  r63380 | georg.brandl | 2008-05-16 13:33:13 -0400 (Fri, 16 May 2008) | 2 lines

  Fix reprlib docs.
........
2008-05-16 18:15:12 +00:00
Christian Heimes e57950fbfe Merged revisions 62420-62421,62423-62424 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r62420 | mark.dickinson | 2008-04-20 20:30:05 +0200 (Sun, 20 Apr 2008) | 3 lines

  Even more fixes for alpha Tru64, this time for
  the phase and polar methods.
........
  r62421 | mark.dickinson | 2008-04-20 22:38:48 +0200 (Sun, 20 Apr 2008) | 2 lines

  Add test for tanh(-0.) == -0. on IEEE 754 systems
........
  r62423 | amaury.forgeotdarc | 2008-04-20 23:02:21 +0200 (Sun, 20 Apr 2008) | 3 lines

  Correct an apparent refleak in test_pkgutil: zipimport._zip_directory_cache contains
  info for all processed zip files, even when they are no longer used.
........
  r62424 | mark.dickinson | 2008-04-20 23:39:04 +0200 (Sun, 20 Apr 2008) | 4 lines

  math.atan2 is misbehaving on Windows;  this patch
  should fix the problem in the same way that
  the cmath.phase problems were fixed.
........
2008-04-21 13:08:03 +00:00
Christian Heimes a342c013fc Merged revisions 62386-62387,62389-62393,62396,62400-62402,62407,62409-62410,62412-62414,62418-62419 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r62386 | christian.heimes | 2008-04-19 04:23:57 +0200 (Sat, 19 Apr 2008) | 2 lines

  Added kill, terminate and send_signal to subprocess.Popen
  The bits and pieces for the Windows side were already in place. The POSIX side is trivial (as usual) and uses os.kill().
........
  r62387 | georg.brandl | 2008-04-19 10:23:59 +0200 (Sat, 19 Apr 2008) | 2 lines

  Fix-up docs for revision 62386.
........
  r62389 | georg.brandl | 2008-04-19 18:57:43 +0200 (Sat, 19 Apr 2008) | 2 lines

  #2369: clarify that copyfile() doesn't take a target directory.
........
  r62390 | georg.brandl | 2008-04-19 18:58:28 +0200 (Sat, 19 Apr 2008) | 2 lines

  #2634: clarify meaning of env parameter to spawn/exec*e.
........
  r62391 | georg.brandl | 2008-04-19 18:58:49 +0200 (Sat, 19 Apr 2008) | 2 lines

  #2633: clarify meaning of env parameter.
........
  r62392 | georg.brandl | 2008-04-19 18:59:16 +0200 (Sat, 19 Apr 2008) | 2 lines

  #2631: clarify IMPORT_NAME semantics.
........
  r62393 | georg.brandl | 2008-04-19 19:00:14 +0200 (Sat, 19 Apr 2008) | 2 lines

  :func: et al. should *not* include the parens.
........
  r62396 | mark.dickinson | 2008-04-19 20:51:48 +0200 (Sat, 19 Apr 2008) | 5 lines

  Additional tests for math.pow, and extra special-case
  handling code in math.pow, in the hope of making all
  tests pass on the alpha Tru64 buildbot.
........
  r62400 | mark.dickinson | 2008-04-19 21:41:52 +0200 (Sat, 19 Apr 2008) | 3 lines

  Additional special-case handling for math.pow.
  Windows/VS2008 doesn't like (-1)**(+-inf).
........
  r62401 | benjamin.peterson | 2008-04-19 21:47:34 +0200 (Sat, 19 Apr 2008) | 2 lines

  Complete documentation for errors argument of io's open and TextIOWrapper
........
  r62402 | mark.dickinson | 2008-04-19 22:31:16 +0200 (Sat, 19 Apr 2008) | 2 lines

  Document updates to math and cmath modules.
........
  r62407 | georg.brandl | 2008-04-19 23:28:38 +0200 (Sat, 19 Apr 2008) | 2 lines

  Update template for newest Sphinx.
........
  r62409 | mark.dickinson | 2008-04-19 23:35:35 +0200 (Sat, 19 Apr 2008) | 5 lines

  Correct documentation for math.pow;
  0**nan is nan, not 0.  (But nan**0 and 1**nan are 1.)

  Also fix minor typo: 'quite NaN' -> 'quiet NaN'
........
  r62410 | mark.dickinson | 2008-04-19 23:49:22 +0200 (Sat, 19 Apr 2008) | 4 lines

  Move asinh documentation to the proper place.
  Remove meaningless 'in radians' from inverse
  hyperbolic functions.
........
  r62412 | mark.dickinson | 2008-04-20 03:22:30 +0200 (Sun, 20 Apr 2008) | 5 lines

  Report additional diagnostic information in
  test_math, to help track down debian-alpha
  buildbot failure.
........
  r62413 | mark.dickinson | 2008-04-20 03:39:24 +0200 (Sun, 20 Apr 2008) | 3 lines

  FreeBSD doesn't follow C99 for modf(inf); so add explicit
  special-value handling to math.modf code.
........
  r62414 | mark.dickinson | 2008-04-20 06:13:13 +0200 (Sun, 20 Apr 2008) | 5 lines

  Yet more explicit special case handling to make
  math.pow behave on alpha Tru64.  All IEEE 754
  special values are now handled directly; only
  the finite**finite case is handled by libm.
........
  r62418 | mark.dickinson | 2008-04-20 18:13:17 +0200 (Sun, 20 Apr 2008) | 7 lines

  Issue 2662: Initialize special value tables dynamically (i.e. when
  cmath module is loaded) instead of statically. This fixes compile-time
  problems on platforms where HUGE_VAL is an extern variable rather than
  a constant.

  Thanks Hirokazu Yamamoto for the patch.
........
  r62419 | andrew.kuchling | 2008-04-20 18:54:02 +0200 (Sun, 20 Apr 2008) | 1 line

  Move description of math module changes; various edits to description of cmath changes
........
2008-04-20 21:01:16 +00:00
Christian Heimes 53876d9cd8 Merged revisions 62380,62382-62383 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r62380 | christian.heimes | 2008-04-19 01:13:07 +0200 (Sat, 19 Apr 2008) | 3 lines

  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 :)
........
  r62382 | christian.heimes | 2008-04-19 01:40:40 +0200 (Sat, 19 Apr 2008) | 2 lines

  Added new files to Windows project files
  More Windows related fixes are coming soon
........
  r62383 | christian.heimes | 2008-04-19 01:49:11 +0200 (Sat, 19 Apr 2008) | 1 line

  Stupid me. Py_RETURN_NAN should actually return something ...
........
2008-04-19 00:31:39 +00:00
Neal Norwitz 1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Raymond Hettinger b67ad7e671 Patch #826074: cmath.log optional base argument, fixes #823209
(Contributed by Andrew Gaul.)
2004-06-14 07:40:10 +00:00
Mark Hammond fe51c6d66e Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main().

Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-08-02 02:27:13 +00:00
Jeremy Hylton 938ace69a0 staticforward bites the dust.
The staticforward define was needed to support certain broken C
compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the
static keyword when it was used with a forward declaration of a static
initialized structure.  Standard C allows the forward declaration with
static, and we've decided to stop catering to broken C compilers.  (In
fact, we expect that the compilers are all fixed eight years later.)

I'm leaving staticforward and statichere defined in object.h as
static.  This is only for backwards compatibility with C extensions
that might still use it.

XXX I haven't updated the documentation.
2002-07-17 16:30:39 +00:00
Martin v. Löwis 14f8b4cfcb Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
Fred Drake f4e3484692 Use the PyModule_*() API instead of manipulating the module dictionary
directly.
2002-04-01 03:45:06 +00:00
Tim Peters dc5a508761 SF bug 525705: [2.2] underflow raise OverflowException.
Another year in the quest to out-guess random C behavior.

Added macros Py_ADJUST_ERANGE1(X) and Py_ADJUST_ERANGE2(X, Y).  The latter
is useful for functions with complex results.  Two corrections to errno-
after-libm-call are attempted:

1. If the platform set errno to ERANGE due to underflow, clear errno.
   Some unknown subset of libm versions and link options do this.  It's
   allowed by C89, but I never figured anyone would do it.

2. If the platform did not set errno but overflow occurred, force
   errno to ERANGE.  C89 required setting errno to ERANGE, but C99
   doesn't.  Some unknown subset of libm versions and link options do
   it the C99 way now.

Bugfix candidate, but hold off until some Linux people actually try it,
with and without -lieee.  I'll send a help plea to Python-Dev.
2002-03-09 04:58:24 +00:00
Martin v. Löwis 387c547fd3 Revert parts of patch #453627, documenting the resulting test failures
instead.
2001-09-06 08:16:17 +00:00
Tim Peters a40c793d06 Rework the way we try to check for libm overflow, given that C99 no longer
requires that errno ever get set, and it looks like glibc is already
playing that game.  New rules:

+ Never use HUGE_VAL.  Use the new Py_HUGE_VAL instead.

+ Never believe errno.  If overflow is the only thing you're interested in,
  use the new Py_OVERFLOWED(x) macro.  If you're interested in any libm
  errors, use the new Py_SET_ERANGE_IF_OVERFLOW(x) macro, which attempts
  to set errno the way C89 said it worked.

Unfortunately, none of these are reliable, but they work on Windows and I
*expect* under glibc too.
2001-09-05 22:36:56 +00:00
Martin v. Löwis 655c9557f6 Patch #453627: Define the following macros when compiling on a UnixWare 7.x system:
SCO_ATAN2_BUG, SCO_ACCEPT_BUG, and STRICT_SYSV_CURSES.
Work aroudn a bug in the SCO UnixWare atan2() implementation.
2001-09-05 14:45:54 +00:00
Tim Peters 1c8e1f0654 asin micro-optimization suggested in email. 2001-02-22 19:51:56 +00:00
Tim Peters edf2210221 Bug #133297: cmath.asin is the same as cmath.asinh.
The bug report title isn't correct, but was on the right track.
Rev 2.13 applied a patch intended to improve asinh and acosh, but the
author mistakenly replaced the body of asin with their new code for asinh.
See bug report for all the gory details.
This patch: (a) puts the "new" (as of 2.13) asinh code into the asinh
function; and, (b) repairs asin via what Abramowitz & Stegun say it should
be (which is probably the same as what 2.12 did for asin, although I got
tired of matching parentheses before being 100% sure of that -- and I don't
care!  The source of the old code is a mystery, and I *know* why I picked
the new code.).
2001-02-21 03:22:39 +00:00
Tim Peters 8cb82bd5fb Rename some constants for easier readability. 2001-02-20 20:36:38 +00:00