summaryrefslogtreecommitdiffstats
path: root/Modules/mathmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #2487. math.ldexp(x, n) raised OverflowError when n was large andMark Dickinson2008-05-091-12/+54
| | | | negative; fix to return an (appropriately signed) zero instead.
* Silence 'r may be used uninitialized' compiler warning.Mark Dickinson2008-04-211-0/+1
|
* math.atan2 is misbehaving on Windows; this patchMark Dickinson2008-04-201-1/+37
| | | | | should fix the problem in the same way that the cmath.phase problems were fixed.
* Yet more explicit special case handling to makeMark Dickinson2008-04-201-47/+55
| | | | | | math.pow behave on alpha Tru64. All IEEE 754 special values are now handled directly; only the finite**finite case is handled by libm.
* FreeBSD doesn't follow C99 for modf(inf); so add explicitMark Dickinson2008-04-201-0/+9
| | | | special-value handling to math.modf code.
* Additional special-case handling for math.pow.Mark Dickinson2008-04-191-6/+13
| | | | Windows/VS2008 doesn't like (-1)**(+-inf).
* Additional tests for math.pow, and extra special-caseMark Dickinson2008-04-191-0/+11
| | | | | handling code in math.pow, in the hope of making all tests pass on the alpha Tru64 buildbot.
* I finally got the time to update and merge Mark's and my trunk-math branch. ↵Christian Heimes2008-04-181-96/+344
| | | | | | 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 :)
* Neaten-up a bit.Raymond Hettinger2008-02-021-5/+1
|
* Move __builtins__.trunc() to math.trunc() perJeffrey Yasskin2008-02-011-0/+16
| | | | | http://mail.python.org/pipermail/python-dev/2008-January/076626.html and issue 1965.
* setup.py doesn't pick up changes to a header fileChristian Heimes2008-01-251-4/+4
|
* Add prototypes to get the mathmodule.c to compile on OSF1 5.1 (Tru64)Neal Norwitz2008-01-251-0/+5
| | | | | and eliminate a compiler warning in floatobject.c. There might be a better way to go about this, but it should be good enough for now.
* Continue rolling back pep-3141 changes that changed behavior from 2.5. ThisJeffrey Yasskin2008-01-051-44/+6
| | | | | | | | | | | | round included: * Revert round to its 2.6 behavior (half away from 0). * Because round, floor, and ceil always return float again, it's no longer necessary to have them delegate to __xxx___, so I've ripped that out of their implementations and the Real ABC. This also helps in implementing types that work in both 2.6 and 3.0: you return int from the __xxx__ methods, and let it get enabled by the version upgrade. * Make pow(-1, .5) raise a ValueError again.
* Fixed math.copysign() on WindowsChristian Heimes2008-01-041-6/+8
|
* Added copysign(x, y) function to the math moduleChristian Heimes2008-01-031-0/+11
|
* Added math.isinf() and math.isnan()Christian Heimes2008-01-031-6/+34
|
* Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (justJeffrey Yasskin2008-01-031-6/+44
| | | | | | | the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361, r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new documentation. The only significant difference is that round(x) returns a float to preserve backward-compatibility. See http://bugs.python.org/issue1689.
* Speed up function calls into the math module by using METH_O.Neal Norwitz2006-11-191-63/+55
| | | | | There should be no functional changes. However, the error msgs are slightly different. Also verified that the module dict is not NULL on init.
* Whoops.Georg Brandl2006-05-291-2/+6
|
* Convert more modules to METH_VARARGS.Georg Brandl2006-05-291-6/+2
|
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* Make that a C, not a C++, comment.Michael W. Hudson2005-04-061-1/+1
|
* Add a comment explaining the import of longintrepr.h.Michael W. Hudson2005-04-061-1/+1
|
* Patch #871657: Set EDOM for `nan' return values on FreeBSD and OpenBSD.Hye-Shik Chang2004-03-221-5/+5
| | | | This fixes a problem that math.sqrt(-1) doesn't raise math.error.
* Getting rid of support for the ancient Apple MPW compiler.Jack Jansen2003-11-191-13/+0
|
* Simplify and speedup uses of Py_BuildValue():Raymond Hettinger2003-10-121-6/+2
| | | | | | * Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c) * Py_BuildValue("()",a) --> PyTuple_New(0) * Py_BuildValue("O", a) --> Py_INCREF(a)
* SF patch #659536: Use PyArg_UnpackTuple where possible.Raymond Hettinger2002-12-291-2/+2
| | | | | | | Obtain cleaner coding and a system wide performance boost by using the fast, pre-parsed PyArg_Unpack function instead of PyArg_ParseTuple function which is driven by a format string.
* Apply SF patch 652930: Add optional base argument to math.log(x[, base]).Raymond Hettinger2002-12-141-15/+47
|
* Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototypeMark Hammond2002-08-021-1/+1
| | | | | | for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches.
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-18/+18
|
* Added degrees() and radians() to mathmodule. Closes patch 552452 andRaymond Hettinger2002-05-131-0/+27
| | | | feature request 426539.
* Revert parts of patch #453627, documenting the resulting test failuresMartin v. Löwis2001-09-061-17/+1
| | | | instead.
* Rework the way we try to check for libm overflow, given that C99 no longerTim Peters2001-09-051-29/+13
| | | | | | | | | | | | | | | 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.
* Patch #453627: Define the following macros when compiling on a UnixWare 7.x ↵Martin v. Löwis2001-09-051-1/+17
| | | | | | | system: SCO_ATAN2_BUG, SCO_ACCEPT_BUG, and STRICT_SYSV_CURSES. Work aroudn a bug in the SCO UnixWare atan2() implementation.
* loghelper(): Try to nudge the compiler into doing mults in an order thatTim Peters2001-09-051-1/+1
| | | | minimizes roundoff error.
* Return reasonable results for math.log(long) and math.log10(long) (we wereTim Peters2001-09-051-4/+64
| | | | | | 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).
* Mechanical fiddling to make this easier to work with in my editor.Tim Peters2001-09-041-18/+12
| | | | Repaired the ldexp docstring (said the name of the func was "ldexp_doc").
* Part of SF patch [#431848] mathmodule.c: doc strings & conversion, fromTim Peters2001-08-071-15/+18
| | | | | | Peter Schneider-Kamp. Clarified some docstrings in the spirit of the patch; left out the degrees() and radians() functions (see the patch comments on SF).
* annoying whitespace inconsistencyPeter Schneider-Kamp2001-06-101-1/+1
|
* Repaired a comment and asserted a precondition.Tim Peters2000-10-121-1/+2
|
* Stop raising OverflowError on underflows reported by libm (errno==ERANGE andTim Peters2000-10-121-18/+42
| | | | | | | | | libm result is 0). Cautiously add a few libm exception test cases: 1. That exp(-huge) returns 0 without exception. 2. That exp(+huge) triggers OverflowError. 3. That sqrt(-1) raises ValueError specifically (apparently under glibc linked with -lieee, it was raising OverflowError due to an accident of the way mathmodule.c's CHECK() macro happened to deal with Infs and NaNs under gcc).
* Fixed legit gripe from c.l.py that math.fmod docs aren't confusing enough.Tim Peters2000-09-161-1/+2
| | | | FRED, please check my monkey-see-monkey-do Tex fiddling!
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* Do the absolute minimal amount of modifications to eradicateBarry Warsaw2000-09-011-2/+1
| | | | | | | | | | | | | | | Py_FatalError() from module initialization functions. The importing mechanism already checks for PyErr_Occurred() after module importation and it Does The Right Thing. Unfortunately, the following either were not compiled or tested by the regression suite, due to issues with my development platform: almodule.c cdmodule.c mpzmodule.c puremodule.c timingmodule.c
* remove all occurence of math.rint() from the sourcesPeter Schneider-Kamp2000-08-101-7/+0
| | | | (and yes, "Currintly" also counts <0.5 wink>)
* merge Include/my*.h into Include/pyport.hPeter Schneider-Kamp2000-07-311-2/+0
| | | | marked my*.h as obsolete
* Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',Thomas Wouters2000-07-211-2/+2
| | | | | | | | | | | | | | | | | | and a couple of functions that were missed in the previous batches. Not terribly tested, but very carefully scrutinized, three times. All these were found by the little findkrc.py that I posted to python-dev, which means there might be more lurking. Cases such as this: long func(a, b) long a; long b; /* flagword */ { and other cases where the last ; in the argument list isn't followed by a newline and an opening curly bracket. Regexps to catch all are welcome, of course ;)
* Typo repair in docstring -- my fault.Tim Peters2000-07-031-1/+1
|
* ANSI-fication, remove Py_PROTO, etc.Fred Drake2000-07-031-84/+74
| | | | | | | Revise math_1(), math_2(), stub-generating macros, and function tables to use PyArg_ParseTuple() and properly provide the function name for error message generation. Fix pow() docstring for MPW 3.1; had said "power" instead of "pow".
* Repair docs for math.frexp (they were wrong).Tim Peters2000-07-021-1/+3
| | | | Reported on c.l.py by Kirill Simonov.