umedoblock umedobl...@gmail.com added the comment:
abs() behavior show below.
type(abs(-1))
class 'int'
type(abs(-1.0))
class 'float'
we should fix this problem if write
Return abs(x) with the sign of y
I'd like to try this problem if need fix.
I'm going to attach the patch.
--
Mark Dickinson dicki...@gmail.com added the comment:
How about something like: Return a float with the magnitude of x but the sign
of y.?
The behaviour of math.copysign with respect to non-float inputs matches that of
almost all the other math module functions: integer arguments are first
Terry J. Reedy tjre...@udel.edu added the comment:
Return a float with the magnitude of x but the sign of y.
This appears to describe both current behavior and what I believe was the
intention. I would go with a doc patch based on this.
umedoblock, go ahead and make one.
It occurred to me,
umedoblock umedobl...@gmail.com added the comment:
I made the patch.
But it cannot pass testCopysign().
math.copysign(1, -0.)
returns 1.
I hope to return -1.
But I don't know how to realize -0. as negative value.
Please help me.
--
components: +Library (Lib) -Documentation
keywords:
Changes by umedoblock umedobl...@gmail.com:
Removed file: http://bugs.python.org/file22249/math_copysign.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12211
___
Changes by umedoblock umedobl...@gmail.com:
Added file: http://bugs.python.org/file22250/math_copysign.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12211
___
Changes by umedoblock umedobl...@gmail.com:
Removed file: http://bugs.python.org/file22250/math_copysign.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12211
___
Terry J. Reedy tjre...@udel.edu added the comment:
umedoblock: David, Mark, and I agree that this should be a doc issue, and so I
suggested a DOC patch. So I do not know why you are screwing around with the
code, or what you are trying to do with it, or why you are messing around with
the
umedoblock umedobl...@gmail.com added the comment:
sorry.
I fix my bug.
but this patch contain new fail...
math.copysign(-1., 0.)
returns 1.
--
Added file: http://bugs.python.org/file22251/math_copysign.patch
___
Python tracker
umedoblock umedobl...@gmail.com added the comment:
I attached DOC patch.
I misunderstand ?
Sorry...
I think that go ahead and make one means I shuold make the source patch.
I use just Python3.2. I didn't use Python 2.x, 3.0 and 3.1 in my programming
life.
Therefore I reported version 3.2.
I
Terry J. Reedy tjre...@udel.edu added the comment:
As with all the math docs, 'x' refers to the value, not the object with the
value. However, Return abs(x) with the sign of y is, to me, clearer and more
accurate. Both doc string and doc chapter should get any modification.
--
nosy:
New submission from umedoblock umedobl...@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 =
Changes by R. David Murray rdmur...@bitdance.com:
--
nosy: +mark.dickinson
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12211
___
___
R. David Murray rdmur...@bitdance.com added the comment:
Except when explicitly noted otherwise, all return values are floats.
On the other hand, copysign says return x with the sign of y, which certainly
sounds like it is preserving x, not creating a new float. So at the least
there is a
14 matches
Mail list logo