Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add floating point error checking to (almost) all casts #21437

Merged
merged 20 commits into from Jun 14, 2022

Commits on Jun 13, 2022

  1. ENH: Check floating point error flags for all casts

    To achieve this, I first need to propagate the ArrayMethod information
    that FPE flags _may_ be given for a specific cast.
    This requires quite a bit of changes (which is arguably the more annoying
    part of the PR/commit).
    Note that for some "legacy" casts, we do not modify this and assume that
    the only interesting information is `needs_api`.
    seberg committed Jun 13, 2022
    Configuration menu
    Copy the full SHA
    8735980 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    341d988 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    84fd4a5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    35dae70 View commit details
    Browse the repository at this point in the history
  5. WIP,TST: Add exhaustive test for FPEs in casts

    unfortunately, I had to realize that float -> integer casts are not
    well defined when values are out of range for the integer.
    This is a problem with C, but means that neither the warnings seem
    to be particularly well defined...
    (I suspect, on my CPU it either warns OR gives "valid" integer overflow
    results, but the question is if that is even universally true...)
    seberg committed Jun 13, 2022
    Configuration menu
    Copy the full SHA
    54d6ac5 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    d53fe91 View commit details
    Browse the repository at this point in the history
  7. fixups

    seberg committed Jun 13, 2022
    Configuration menu
    Copy the full SHA
    4c2a3d0 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    a5bf28b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    96fd8ba View commit details
    Browse the repository at this point in the history
  10. TST: Fix the weird boolean+advanced indexing test

    The test meant to assert shapes, but didn't actually do it.
    seberg committed Jun 13, 2022
    Configuration menu
    Copy the full SHA
    fc865d8 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    219697a View commit details
    Browse the repository at this point in the history
  12. BUG: Fix needs_api for avanced assignments without subspace and remov…

    …e unnecessary delay
    
    The delay is not necessary, because the iterator does not cast in any case, so we do not
    actually care about the possibility of errors being raised.
    seberg committed Jun 13, 2022
    Configuration menu
    Copy the full SHA
    9c74efa View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    d41f1de View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    8d2d9a5 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    b463a7f View commit details
    Browse the repository at this point in the history
  16. BUG: Avoid NpyIter_EnableExternalLoop as it resets the buffer

    Resetting the buffer will copy it, which may cause casting errors.
    And we want to prefer/catch those later ideally.
    seberg committed Jun 13, 2022
    Configuration menu
    Copy the full SHA
    63fa74a View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    a7e58a7 View commit details
    Browse the repository at this point in the history
  18. TST: Add final set of cast (and FPE in cast) test to ufuncs

    The remaining uncovered paths seem to me like code that should be
    effectively unreachable.
    (I do actually wonder if `PyArray_MapIterReset` should be removed.)
    seberg committed Jun 13, 2022
    Configuration menu
    Copy the full SHA
    f7b0493 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    7e6d8ef View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    a546ee1 View commit details
    Browse the repository at this point in the history