diff options
author | Ross Barnowski <rossbar@berkeley.edu> | 2020-08-03 16:08:14 -0700 |
---|---|---|
committer | Ross Barnowski <rossbar@berkeley.edu> | 2020-08-03 16:08:14 -0700 |
commit | 1f2aef37cbaf83749699af6e80a33bd02b74b729 (patch) | |
tree | c744fff14d95717beffbcd849ee416c9173099b8 /doc | |
parent | 8e914cf7f1c6433c8f7f76eccdb67375fece4126 (diff) | |
download | numpy-1f2aef37cbaf83749699af6e80a33bd02b74b729.tar.gz |
DOC: Add example to release note
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/upcoming_changes/16841.change.rst | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/release/upcoming_changes/16841.change.rst b/doc/release/upcoming_changes/16841.change.rst index 9f112fd52..d9499b6f4 100644 --- a/doc/release/upcoming_changes/16841.change.rst +++ b/doc/release/upcoming_changes/16841.change.rst @@ -2,4 +2,18 @@ --------------------------------------- When using a `int` dtype in `numpy.linspace`, previously float values would be rounded towards zero. Now `numpy.floor` is used instead, which rounds toward -``-inf``. This changes the results for negative values. +``-inf``. This changes the results for negative values. For example, the +following would previously give:: + + >>> np.linspace(-3, 1, 8, dtype=int) + array([-3, -2, -1, -1, 0, 0, 0, 1]) + +and now results in:: + + >>> np.linspace(-3, 1, 8, dtype=int) + array([-3, -3, -2, -2, -1, -1, 0, 1]) + +The former result can still be obtained with:: + + >>> np.linspace(-3, 1, 8).astype(int) + array([-3, -2, -1, -1, 0, 0, 0, 1]) |