New submission from Daniel Stutzbach <dan...@stutzbachenterprises.com>:

I noticed that in longobject.c, there are a few spots that take the absolute 
value of an int before comparing the int to 0.  There's no -0 for C integers, 
so the absolute value isn't necessary.

I traced back through the commit history, and it looks like they're an artifact 
of the original one's-complement longobject.c (which COULD have -0).  
longobject was switched to two's-complement in 1992. ;-)

----------
assignee: stutzbach
components: Interpreter Core
files: abs-zero.patch
keywords: patch
messages: 105265
nosy: stutzbach
priority: normal
severity: normal
stage: patch review
status: open
title: ABS(x) == 0 can be simplified to x == 0
type: performance
versions: Python 3.2
Added file: http://bugs.python.org/file17259/abs-zero.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8659>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to