diff options
author | Anirudh Subramanian <anirudh2290@apache.org> | 2020-04-16 11:55:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-16 13:55:34 -0500 |
commit | b38ccec64c502579f48c1fc13d0b34f689171f25 (patch) | |
tree | 10c7507028a5019f47bbf15a74a8b9d9842af094 /doc | |
parent | 52c9e6f2e3e72081576fc7f629fe3eb0c67b143b (diff) | |
download | numpy-b38ccec64c502579f48c1fc13d0b34f689171f25.tar.gz |
NEP: Improve Value Based Casting paragraph in NEP 40 (#16000)
* DOC: Improve Value Based Casting doc
* Update doc/neps/nep-0040-legacy-datatype-impl.rst
Co-Authored-By: Ross Barnowski <rossbar@berkeley.edu>
* Update doc/neps/nep-0040-legacy-datatype-impl.rst
Co-Authored-By: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/neps/nep-0040-legacy-datatype-impl.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/neps/nep-0040-legacy-datatype-impl.rst b/doc/neps/nep-0040-legacy-datatype-impl.rst index a768fa08c..799c6c026 100644 --- a/doc/neps/nep-0040-legacy-datatype-impl.rst +++ b/doc/neps/nep-0040-legacy-datatype-impl.rst @@ -109,11 +109,11 @@ This is useful for example in expressions such as:: In this expression, the python value (which originally has no datatype) is represented as an ``int8`` or ``int16`` (the smallest possible data type). -NumPy currently does this even for NumPy scalars and zero dimensional arrays, +NumPy currently does this even for NumPy scalars and zero-dimensional arrays, so that replacing ``5`` with ``np.int64(5)`` or ``np.array(5, dtype="int64")`` -will lead to the same results, and thus ignores the existing datatype. -The same logic also applies to floating point scalars, which are allowed to -lose precision. +in the above expression will lead to the same results, and thus ignores the +existing datatype. The same logic also applies to floating-point scalars, +which are allowed to lose precision. The behavior is not used when both inputs are scalars, so that ``5 + np.int8(5)`` returns the default integer size (32 or 64-bit) and not an ``np.int8``. |