diff options
author | gfyoung <gfyoung17@gmail.com> | 2016-02-03 08:55:34 +0000 |
---|---|---|
committer | gfyoung <gfyoung17@gmail.com> | 2016-03-13 22:23:44 +0100 |
commit | b03527ded99dd7f6e2c6dd85ca3fdd043398d8bc (patch) | |
tree | e1ae6cc98c04d24fc9e48296ef6aa9e258b42c1b /doc | |
parent | 3eff0ae052c954081e542f14be5891e1310e71f7 (diff) | |
download | numpy-b03527ded99dd7f6e2c6dd85ca3fdd043398d8bc.tar.gz |
BUG: Fix binary_repr for negative numbers
Completely rewrote binary_repr method to use
the Python's built-in 'bin' function to generate
binary representations quickly.
Fixed the behaviour for negative numbers in which
insufficient widths resulted in outputs of all zero's
for the two's complement. Now, it will return the
two's complement with width equal to the minimum
number of bits needed to represent the complement.
Closes gh-7168.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/1.12.0-notes.rst | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/doc/release/1.12.0-notes.rst b/doc/release/1.12.0-notes.rst index 946a6bfdf..38e5e4338 100644 --- a/doc/release/1.12.0-notes.rst +++ b/doc/release/1.12.0-notes.rst @@ -154,10 +154,18 @@ Deprecations Assignment of ndarray object's ``data`` attribute ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Assigning the 'data' attribute is an inherently unsafe operation as pointed +Assigning the 'data' attribute is an inherently unsafe operation as pointed out in gh-7083. Such a capability will be removed in the future. Unsafe int casting of the num attribute in linspace ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -``np.linspace`` now raises DeprecationWarning when num cannot be safely +``np.linspace`` now raises DeprecationWarning when num cannot be safely interpreted as an integer. + +Insufficient bit width parameter to ``binary_repr`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +If a 'width' parameter is passed into ``binary_repr`` that is insufficient to +represent the number in base 2 (positive) or 2's complement (negative) form, +the function used to silently ignore the parameter and return a representation +using the minimal number of bits needed for the form in question. Such behavior +is now considered unsafe from a user perspective and will raise an error in the future. |