summaryrefslogtreecommitdiffstats
path: root/Modules/mathmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* The addition of rint() (by Peter Schneider-Kamp; I forgot to mentionGuido van Rossum2000-05-111-0/+4
| | | | | | that before) in the previous patch has one problem; rint() is not in the C math library on all platforms (e.g. not for VC++). Make it conditional on HAVE_RINT.
* Added math.rint() -- round according to current IEEE754 modeGuido van Rossum2000-05-111-0/+3
|
* Trent Mick:Guido van Rossum2000-05-081-4/+4
| | | | | | | | | | | | | Fix overflow bug in ldexp(x, exp). The 'exp' argument maps to a C int for the math library call [double ldexp(double, int)], however the 'd' PyArg_ParseTuple formatter was used to yield a double, which was subsequently cast to an int. This could overflow. [GvR: mysteriously, on Solaris 2.7, ldexp(1, 2147483647) returns Inf while ldexp(1, 2147483646) raises OverflowError; this seems a bug in the math library (it also takes a real long time to compute the Inf outcome). Does this point to a bug in the CHECK() macro? It should have discovered that the result was outside the HUGE_VAL range.]
* Correctly document atan2.Guido van Rossum1998-12-081-1/+1
|
* Added Doc strings -- by Chris Petrilli.Guido van Rossum1998-12-041-50/+97
|
* Add DL_EXPORT() to all modules that could possibly be usedGuido van Rossum1998-12-041-1/+1
| | | | on BeOS or Windows.
* Removed MetroWerks workaround, replaced by defines in mymath.h (Jack)Guido van Rossum1997-05-201-5/+0
|
* New form of PyFPE_END_PROTECT macro.Guido van Rossum1997-03-141-3/+3
|
* Changes for Lee Busby's SIGFPE patch set.Guido van Rossum1997-02-141-0/+6
| | | | | Two new modules fpectl and fpetest. Surround various and sundry f.p. operations with PyFPE_*_PROTECT macros.
* Removed references to getdoublearg and get2doublearg rename macros andRoger E. Masse1996-12-181-8/+5
| | | | substituted the appropriate PyArg_Parse calls. Retested. All appears well.
* Correct *another* mistake (initmath() always fell through to fatal error).Guido van Rossum1996-12-181-0/+1
| | | | Watch it, Barry! :-)
* Correct 1-char typo / syntax error.Guido van Rossum1996-12-181-1/+1
|
* Better error checking in initmath().Barry Warsaw1996-12-171-2/+13
|
* RenamedBarry Warsaw1996-12-091-43/+42
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Move backup definition for hypot() to Python/hypot.c.Guido van Rossum1996-08-291-27/+0
|
* Avoid complaint about inconsistent hypot() linkage on NT.Guido van Rossum1996-08-211-0/+2
|
* Hack for Mac (where fabs is not usable as a function pointer).Guido van Rossum1996-08-081-0/+5
|
* Don't make an exception for NeXT (BBUM says it's no longer needed).Guido van Rossum1996-07-301-1/+1
| | | | | (But hypot() should really be defined in a separate file, triggered by configure.)
* Microsoft C changesGuido van Rossum1996-05-231-1/+4
|
* added default hypot() implementationGuido van Rossum1996-01-121-4/+21
|
* NeXT doesn't like me to declare hypot(double, double)Guido van Rossum1995-06-141-1/+1
|
* include mymath.hGuido van Rossum1995-03-011-1/+1
|
* cleanupGuido van Rossum1995-01-221-4/+0
|
* rearrange declarations somewhatGuido van Rossum1995-01-121-11/+11
|
* Added 1995 to copyright message.Guido van Rossum1995-01-041-2/+2
| | | | | Setup.in: clarified Tk comments somewhat. structmodule.c: use memcpy() instead of double precision assignment.
* Another bulky set of minor changes.Guido van Rossum1995-01-021-0/+4
| | | | | Note addition of gethostbyaddr() and improved repr() for sockets, renaming of md5.md5() to md5.new(), and fixing of leaks in threads.
* add hypot()Guido van Rossum1994-10-201-0/+2
|
* Merge alpha100 branch back to main trunkGuido van Rossum1994-08-011-1/+15
|