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

is_nan: Restrict to numbers and add is_numerical #486

Open
m-mohr opened this issue Dec 11, 2023 · 2 comments
Open

is_nan: Restrict to numbers and add is_numerical #486

m-mohr opened this issue Dec 11, 2023 · 2 comments

Comments

@m-mohr
Copy link
Member

m-mohr commented Dec 11, 2023

Process ID: is_nan / is_numerical

Describe the issue:
is_nan is a bit weird in that it also returns true for data types that are not numbers.

Proposed solution:
Make is_nan be compliant with most other languages and only return True if the value is actual a float NaN.

The existing behavior could be inversed and be part of a new process is_numerical (returns true for all integers and floating point numbers except for NaN, false for NaN and all non-numerical data types).

Any opinions? @soxofaan @clausmichele

@soxofaan
Copy link
Member

and what should is_nan("a string") or is_nan([1, 2, 3]) result in? False or throw an error?

@m-mohr
Copy link
Member Author

m-mohr commented Dec 11, 2023

An error because the data type would not be allowed any longer.

I'm not sure whether the proposed change is required, it just looks like the current implementations don't implement it correctly anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants