[Python-checkins] CVS: python/dist/src/Objects longobject.c,1.102,1.103
Tim Peters
tim_one@users.sourceforge.net
Thu, 06 Sep 2001 14:59:16 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv13553/python/Objects
Modified Files:
longobject.c
Log Message:
long_true_divide: reliably force underflow to 0 when the denominator
has more bits than the numerator than can be counted in a C int (yes,
that's unlikely, and no, I'm not adding a test case with a 2 gigabit
long).
Index: longobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -C2 -d -r1.102 -r1.103
*** longobject.c 2001/09/05 06:24:58 1.102
--- longobject.c 2001/09/06 21:59:14 1.103
***************
*** 1606,1609 ****
--- 1606,1611 ----
if (aexp > INT_MAX / SHIFT)
goto overflow;
+ else if (aexp < -(INT_MAX / SHIFT))
+ return PyFloat_FromDouble(0.0); /* underflow to 0 */
errno = 0;
ad = ldexp(ad, aexp * SHIFT);