[issue12211] Better document math.copysign behavior.

2014-02-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3ad7725b5013 by Andrew Kuchling in branch '3.3': #12211: clarify math.copysign() documentation and docstring http://hg.python.org/cpython/rev/3ad7725b5013 -- nosy: +python-dev ___ Python tracker

[issue12211] Better document math.copysign behavior.

2014-02-16 Thread A.M. Kuchling
A.M. Kuchling added the comment: Applied. I added two sentences describing the NaN behaviour. -- nosy: +akuchling resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue12211] Better document math.copysign behavior.

2014-02-16 Thread Mark Dickinson
Mark Dickinson added the comment: The paragraph about NaNs isn't correct. For example: from math import copysign copysign(1.0, float('nan')) 1.0 copysign(1.0, -float('nan')) -1.0 Though it doesn't really make sense to talk about 'positive' or 'negative' NaNs, a NaN still has a sign bit,

[issue12211] Better document math.copysign behavior.

2014-02-16 Thread A.M. Kuchling
A.M. Kuchling added the comment: OK; I'll just drop the 'If y is NaN' sentence. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___

[issue12211] Better document math.copysign behavior.

2014-02-16 Thread Mark Dickinson
Mark Dickinson added the comment: More examples, showing that `y` is not ignored when `x` is a NaN. result1 = copysign(float('nan'), 1.0) result2 = copysign(float('nan'), -1.0) copysign(1.0, result1) # result1 is a NaN whose sign bit is cleared. 1.0 copysign(1.0, result2) # result2 is a

[issue12211] Better document math.copysign behavior.

2014-02-16 Thread A.M. Kuchling
A.M. Kuchling added the comment: Actually ISTM the 'if x is NaN' sentence can also go; it seems to just copy the sign bit no matter what x and y are. from math import * nan = float('nan') neg = -nan copysign(+1, copysign(nan, neg)) -1.0 -- ___

[issue12211] Better document math.copysign behavior.

2014-02-16 Thread Mark Dickinson
Mark Dickinson added the comment: It seems to just copy the sign bit no matter what x and y are. Yep, that's exactly what happens. The sign bit from y just gets blindly transferred to x, with no regard to any meaning of x or y. So it works exactly the same way for zeros, NaNs, infinities,

[issue12211] Better document math.copysign behavior.

2014-02-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset b01f4ed077fa by Andrew Kuchling in branch '3.3': #12211: remove paragraph about NaNs http://hg.python.org/cpython/rev/b01f4ed077fa -- ___ Python tracker rep...@bugs.python.org

[issue12211] Better document math.copysign behavior.

2014-02-16 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks! (And apologies for the nitpicking.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___

[issue12211] Better document math.copysign behavior.

2013-06-30 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.4 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___

[issue12211] Better document math.copysign behavior.

2011-06-26 Thread Sandro Tosi
Sandro Tosi sandro.t...@gmail.com added the comment: Taken from http://www.slac.stanford.edu/comp/unix/package/rtems/doc/html/libm/libm.info.copysign.html i'd suggest to extend Return a float with the magnitude of x to Return a float with the magnitude (absolute value) of x It could

[issue12211] Better document math.copysign behavior.

2011-06-26 Thread umedoblock
umedoblock umedobl...@gmail.com added the comment: sandro: OK, I attached the new patch. -- Added file: http://bugs.python.org/file22480/issue_12211_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211

[issue12211] Better document math.copysign behavior.

2011-06-26 Thread Sandro Tosi
Sandro Tosi sandro.t...@gmail.com added the comment: well, what I actually meant is to describe the behavior in case one (or both) of the arguments is NaN (so not cutpasting the code), while the example was just provided as a quick reference. --

[issue12211] Better document math.copysign behavior.

2011-06-26 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: I agree with adding '(absolute value)'. I think the following covers the NaN behavior. NaN acts as a positive value that cannot be negated. This should be added to both doc and docstring. I do not think we generally specify the nan behavior

[issue12211] Better document math.copysign behavior.

2011-06-07 Thread umedoblock
umedoblock umedobl...@gmail.com added the comment: I'm late, sorry. I attached the patch for math.rst and mathmodule.c. -- Added file: http://bugs.python.org/file22278/issue_12211.patch ___ Python tracker rep...@bugs.python.org

[issue12211] Better document math.copysign behavior.

2011-06-05 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Third party refers to things other than Pythonx.y code For instance, distutils2/distribute was for some years developed separately from the main codebase and was recently merged into the 3.3 repository. While separate, its issues were '3rd

[issue12211] Better document math.copysign behavior.

2011-06-05 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: I think we should include the On a platform ... Sure, sounds good. One of the main things that makes copysign useful is that it distinguishes between -0.0 and 0.0. -- ___ Python tracker