Skip to content

Commit

Permalink
DOC: Shorten release note about FPE warnings in casts
Browse files Browse the repository at this point in the history
Co-authored-by: Matti Picus <matti.picus@gmail.com>
  • Loading branch information
seberg and mattip committed Jun 12, 2022
1 parent c47b94e commit 38d1373
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions doc/release/upcoming_changes/21437.improvement.rst
Expand Up @@ -8,26 +8,13 @@ For examples, casts like::
np.array([2e300]).astype(np.float32) # overflow for float32
np.array([np.inf]).astype(np.int64)

Should now generally give floating point warnings. These warnings
should warn that floating point overflow occurred.
For errors when converting floating point values to integers users
should expect invalid value warnings.
Should now generally give floating point overflow warnings.
Errors when converting floating point values to integers may emit
invalid value warnings.

Users can modify the behavior of these warnings using `np.errstate`.

Note that for float to int casts, the exact warnings that are given may
be platform dependend. For example::

arr = np.full(100, value=1000, dtype=np.float64)
arr.astype(np.int8)

May give a result equivalent to (the intermediat means no warning is given)::

arr.astype(np.int64).astype(np.int8)

May may return an undefined result, with a warning set::

RuntimeWarning: invalid value encountered in cast

The precise behavior if subject to the C99 standard and its implementation
be platform dependent.
The precise behavior is subject to the C99 standard and its implementation
in both software and hardware.

0 comments on commit 38d1373

Please sign in to comment.