Skip to content

MAINT,ENH: Use non-error functions isless, isgreater, etc. #19398

@seberg

Description

@seberg

The functions isless, and friends (see https://en.cppreference.com/w/c/numeric/math/isless) are C99 standardized and should be equivalent to the normal math operators but not set floating point exceptions. I expect that using these macros would remove almost all of the places where we currently set npy_clear_floatstatus_barrier().

That would both slightly speed things up (at least if errors did occur npy_clear_floatstatus_barrier is pretty slow), and just be slightly more correct not to worry set the flags in the first place.

In the long-run, I am also thinking of chaining (e.g. by numexpr), where a call to npy_clear_floatstatus_barrier could silence floating point warnings, if the ufuncs are chained in lowlevel C.

EDIT: https://www.gnu.org/software/libc/manual/html_node/FP-Comparison-Functions.html is probably a nice reference

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions