summaryrefslogtreecommitdiffstats
path: root/Include/pymath.h
Commit message (Collapse)AuthorAgeFilesLines
* gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)Sebastian Berg2023-05-101-14/+11
| | | | | | | | | | This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of using the standard `NAN` and `INFINITY` macros provided by C99. This change has the side-effect of fixing a bug on MIPS where the hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN rather than a quiet NaN. --------- Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-46656: Remove Py_NO_NAN macro (GH-31160)Victor Stinner2022-02-251-5/+2
| | | | Building Python now requires support for floating point Not-a-Number (NaN): remove the Py_NO_NAN macro.
* bpo-46640: Py_NAN now uses the C99 NAN constant (GH-31134)Victor Stinner2022-02-061-21/+10
| | | | | | Building Python now requires a C99 <math.h> header file providing a NAN constant, or the __builtin_nan() built-in function. If a platform does not support Not-a-Number (NaN), the Py_NO_NAN macro can be defined in the pyconfig.h file.
* bpo-45440: Require math.h isinf() to build (GH-28894)Victor Stinner2021-10-131-71/+9
| | | | | | | | | | | | | | | Building Python now requires a C99 <math.h> header file providing isinf(), isnan() and isfinite() functions. Remove the Py_FORCE_DOUBLE() macro. It was used by the Py_IS_INFINITY() macro. Changes: * Remove Py_IS_NAN(), Py_IS_INFINITY() and Py_IS_FINITE() in PC/pyconfig.h. * Remove the _Py_force_double() function. * configure no longer checks if math.h defines isinf(), isnan() and isfinite().
* bpo-45412: Move copysign() define to pycore_pymath.h (GH-28889)Victor Stinner2021-10-111-52/+21
| | | | | Move definitions of copysign(), round(), hypot(), fmod(), etc. from pymath.h to pycore_pymath.h. These functions are not exported by libpython and so must not be part of the C API.
* bpo-45412: Move _Py_SET_53BIT_PRECISION_START to pycore_pymath.h (GH-28882)Victor Stinner2021-10-111-12/+5
| | | | | | | | | | | | | | | Move the following macros , to pycore_pymath.h (internal C API): * _Py_SET_53BIT_PRECISION_HEADER * _Py_SET_53BIT_PRECISION_START * _Py_SET_53BIT_PRECISION_END PEP 7: add braces to if and "do { ... } while (0)" in these macros. Move also _Py_get_387controlword() and _Py_set_387controlword() definitions to pycore_pymath.h. These functions are no longer exported. pystrtod.c now includes pycore_pymath.h.
* bpo-45412: Remove Py_SET_ERRNO_ON_MATH_ERROR() macro (GH-28820)Victor Stinner2021-10-111-46/+0
| | | | | | | | | | | | | | | | | | | | | | Remove the following math macros using the errno variable: * Py_ADJUST_ERANGE1() * Py_ADJUST_ERANGE2() * Py_OVERFLOWED() * Py_SET_ERANGE_IF_OVERFLOW() * Py_SET_ERRNO_ON_MATH_ERROR() Create pycore_pymath.h internal header file. Rename Py_ADJUST_ERANGE1() and Py_ADJUST_ERANGE2() to _Py_ADJUST_ERANGE1() and _Py_ADJUST_ERANGE2(), and convert these macros to static inline functions. Move the following macros to pycore_pymath.h: * _Py_IntegralTypeSigned() * _Py_IntegralTypeMax() * _Py_IntegralTypeMin() * _Py_InIntegralTypeRange()
* bpo-45094: Add Py_NO_INLINE macro (GH-28140)Victor Stinner2021-09-031-6/+1
| | | | | * Rename _Py_NO_INLINE macro to Py_NO_INLINE: make it public and document it. * Sort macros in the C API documentation.
* bpo-29782: Consolidate _Py_Bit_Length() (GH-20739)Niklas Fiekas2020-06-151-8/+0
| | | | | | | | | | In GH-2866, _Py_Bit_Length() was added to pymath.h for lack of a better location. GH-20518 added a more appropriate header file for bit utilities. It also shows how to properly use intrinsics. This allows reconsidering bpo-29782. * Move the function to the new header. * Changed return type to match __builtin_clzl() and reviewed usage. * Use intrinsics where available. * Pick a fallback implementation suitable for inlining.
* bpo-31031: Unify duplicate bits_in_digit and bit_length (GH-2866)Niklas Fiekas2020-01-161-0/+8
| | | Add _Py_bit_length() to unify duplicate bits_in_digit() and bit_length().
* Fix typos in comments, docs and test names (#15018)Min ho Kim2019-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Fix typos in comments, docs and test names * Update test_pyparse.py account for change in string length * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: Dealloccte -> Deallocate Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Update posixmodule checksum. * Reverse idlelib changes.
* bpo-31373: fix undefined floating-point demotions (#3396)Benjamin Peterson2017-09-071-11/+23
|
* Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-1/+1
|
* Issue #12345: Add mathemathcal constant tau to math and cmath.Guido van Rossum2016-08-151-0/+6
| | | | Patch by Lisa Roach. See also PEP 628.
* Issue #25923: Added the const qualifier to static constant arrays.Serhiy Storchaka2015-12-251-1/+1
|
* #21167: Fix definition of NAN when ICC used without -fp-model strict.R David Murray2015-08-131-1/+23
| | | | Patch from Chris Hogan of Intel, reviewed by Mark Dickinson.
* Issue #11495: OSF support is eliminated. It was deprecated in Python 3.2Jesus Cea2011-03-141-6/+0
|
* Merge branches/pep-0384.Martin v. Löwis2010-12-031-0/+4
|
* Merged revisions 76978 via svnmerge fromMark Dickinson2009-12-211-19/+3
| | | | | | | | | | | 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. ........
* Merged revisions 73660 via svnmerge fromMark Dickinson2009-06-281-4/+0
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r73660 | mark.dickinson | 2009-06-28 23:37:13 +0100 (Sun, 28 Jun 2009) | 1 line Remove unused stdint.h includes ........
* Add check for C99 round function to configure, and defineMark Dickinson2009-04-181-0/+4
| | | | a fallback function if round doesn't exist.
* Issue #1580: use short float repr where possible.Mark Dickinson2009-04-161-0/+5
| | | | | | | | | | | | | | | - incorporate and adapt David Gay's dtoa and strtod into the Python core - on platforms where we can use Gay's code (almost all!), repr(float) is based on the shortest sequence of decimal digits that rounds correctly. - add sys.float_repr_style attribute to indicate whether we're using Gay's code or not - add autoconf magic to detect and enable SSE2 instructions on x86/gcc - slight change to repr and str: repr switches to exponential notation at 1e16 instead of 1e17, str switches at 1e11 instead of 1e12
* Merged revisions 69459 via svnmerge fromMark Dickinson2009-02-091-5/+24
| | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r69459 | mark.dickinson | 2009-02-09 14:18:43 +0000 (Mon, 09 Feb 2009) | 3 lines Issue #4575: fix Py_IS_INFINITY macro to work correctly on x87 FPUs. It now forces its argument to double before testing for infinity. ........
* Merged revisions 68311 via svnmerge fromMark Dickinson2009-01-051-1/+3
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r68311 | mark.dickinson | 2009-01-04 19:53:00 +0000 (Sun, 04 Jan 2009) | 2 lines Use C99 'isfinite' macro in preference to BSD-derived 'finite' function. ........
* Merged revisions 68304 via svnmerge fromMark Dickinson2009-01-041-2/+2
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r68304 | mark.dickinson | 2009-01-04 17:02:05 +0000 (Sun, 04 Jan 2009) | 2 lines Fix HAVE_DECL_ISINF/ISNAN test (again). ........
* Merged revisions 68302 via svnmerge fromMark Dickinson2009-01-041-2/+2
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r68302 | mark.dickinson | 2009-01-04 16:06:40 +0000 (Sun, 04 Jan 2009) | 4 lines Oops. Need to check not only that HAVE_DECL_ISINF is defined, but also that it's equal to 1. (If isinf isn't defined, HAVE_DECL_ISINF is defined to be 0, rather than being undefined.) ........
* Merged revisions 68296,68299 via svnmerge fromMark Dickinson2009-01-041-2/+2
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r68296 | mark.dickinson | 2009-01-04 12:29:36 +0000 (Sun, 04 Jan 2009) | 6 lines Add autoconf test to detect x87-style double rounding, as described in issue #2937. This information can be helpful for diagnosing platform- specific problems in math and cmath. The result of the test also serves as a fairly reliable indicator of whether the x87 floating-point instructions (as opposed to SSE2) are in use on Intel x86/x86_64 systems. ........ r68299 | mark.dickinson | 2009-01-04 13:57:26 +0000 (Sun, 04 Jan 2009) | 4 lines isinf and isnan are macros, not functions; fix configure script to use AC_CHECK_DECLS instead of AC_CHECK_FUNCS for these. (See discussion in issue #4506) ........
* Merged revisions 65658,65869,65882 via svnmerge fromBenjamin Peterson2008-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ................ r65658 | bill.janssen | 2008-08-12 12:09:57 -0500 (Tue, 12 Aug 2008) | 1 line update ssl documentation ................ r65869 | benjamin.peterson | 2008-08-19 14:27:53 -0500 (Tue, 19 Aug 2008) | 1 line fix a little typo ................ r65882 | benjamin.peterson | 2008-08-19 16:07:15 -0500 (Tue, 19 Aug 2008) | 9 lines Merged revisions 65876 via svnmerge from svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r65876 | benjamin.peterson | 2008-08-19 15:54:52 -0500 (Tue, 19 Aug 2008) | 1 line apply a fix I think will help Windows ........ ................
* Merged revisions 62380,62382-62383 via svnmerge fromChristian Heimes2008-04-191-0/+182
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 ... ........