[ python-Bugs-1202946 ] Problem with abs function

SourceForge.net noreply at sourceforge.net
Mon May 16 19:33:52 CEST 2005


Bugs item #1202946, was opened at 2005-05-16 11:32
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1202946&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: ric-b (ric-b)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problem with abs function

Initial Comment:
On windows version I get :

>>> abs(-9999999999999999999)

Traceback (most recent call last):
  File "<pyshell#7>", line 1, in -toplevel-
    abs(-9999999999999999999)
OverflowError: long too big to convert

does not handle new longs.


I am using the following work around:

            t = a - b  # calc t = abs(a - b)
            if t < 0 :  
                t *= -1


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2005-05-16 12:33

Message:
Logged In: YES 
user_id=80475

That's odd.  It works for me:

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> abs(-9999999999999999999)
9999999999999999999L


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1202946&group_id=5470


More information about the Python-bugs-list mailing list