[issue12211] math.copysign must keep object type.

umedoblock report at bugs.python.org
Mon May 30 01:02:30 CEST 2011


New submission from umedoblock <umedoblock at gmail.com>:

I expected return int if I gave x as integer to copysign.

I encounterd two problems.
I'd like to fix this problems.
but I can't come up with nice idea.
therefore I just report for you.

one:
>>> import math
>>> a = [0, 1, 2, 3]
>>> i = 1
>>> i_copysign = math.copysign(i, -1)
>>> a[i_copysign]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list indices must be integers, not float

two:
>>> n = 10 ** 20
>>> math.copysign(n + 1, 1) == n + 1
False

----------
components: Library (Lib)
messages: 137226
nosy: umedoblock
priority: normal
severity: normal
status: open
title: math.copysign must keep object type.
type: behavior
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12211>
_______________________________________


More information about the Python-bugs-list mailing list