Commit Graph

28 Commits

Author SHA1 Message Date
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
Tim Peters 14e26408f3 Mechanical edits just so I can read it. 2001-02-20 20:15:19 +00:00
Andrew M. Kuchling e365fb8d1f Use METH_VARARGS instead of numeric constant 1 in method def. tables 2000-08-03 02:06:16 +00:00
Peter Schneider-Kamp 7e01890986 merge Include/my*.h into Include/pyport.h
marked my*.h as obsolete
2000-07-31 15:28:04 +00:00
Thomas Wouters eb61b6ebb6 Fix typo in previous patch. 2000-07-24 11:17:40 +00:00
Thomas Wouters ccada2421b *** empty log message *** 2000-07-24 11:09:37 +00:00
Thomas Wouters f3f33dcf03 Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
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 ;)
2000-07-21 06:00:07 +00:00
Peter Schneider-Kamp f1ca898d85 ANSI-fication 2000-07-10 09:31:34 +00:00
Tim Peters dbd9ba6a6c Nuke all remaining occurrences of Py_PROTO and Py_FPROTO. 2000-07-09 03:09:57 +00:00
Guido van Rossum f385c5e544 Patch by Nadav Horesh to make acosh and asinh better.
Tim posted a long comment to python-dev (subject: "Controversial patch
(cmath)"; date: 6/29/00).  The conclusion is that this whole module
stinks and this patch isn't perfect, but it's better than the acosh
and asinh we had, so let's check it in.
2000-06-30 02:29:22 +00:00
Fred Drake 0e11c49f04 Docstring fix: acosh() returns the hyperbolic arccosine, not the
hyperbolic cosine.  Problem report via David Ascher by one of his
students.
1999-03-16 14:17:48 +00:00
Guido van Rossum 11a5071ed6 Jim Ahlstrom patch: Watcom chokes on a long expression in c_asinh().
Break it up.
1999-01-14 19:11:11 +00:00
Guido van Rossum c6e22902ad Added Doc strings -- by Chris Petrilli. 1998-12-04 19:26:43 +00:00
Guido van Rossum 3886bb6997 Add DL_EXPORT() to all modules that could possibly be used
on BeOS or Windows.
1998-12-04 18:50:17 +00:00
Guido van Rossum 45b83915f8 New form of PyFPE_END_PROTECT macro. 1997-03-14 04:32:50 +00:00
Guido van Rossum 52fa3a6909 Changes for Lee Busby's SIGFPE patch set.
Two new modules fpectl and fpetest.
Surround various and sundry f.p. operations with PyFPE_*_PROTECT macros.
1997-02-14 22:59:58 +00:00
Guido van Rossum 09f99dfdba Removed redundant inclusion of <errno.h> (sorry, Roj!). 1996-12-10 00:12:14 +00:00
Roger E. Masse 24070ca391 Renamed Grandly 1996-12-09 22:59:53 +00:00
Guido van Rossum a376cc5cc8 Keep gcc -Wall happy. 1996-12-05 23:43:35 +00:00
Guido van Rossum 9e720e390a complex -> Py_complex 1996-07-21 02:31:35 +00:00
Guido van Rossum 9c8a0c4b1c Made all c_* symbols static. 1996-05-24 21:12:28 +00:00
Guido van Rossum 71aa32f4af complex math 1996-01-12 01:34:57 +00:00