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

Define isnan for AbstractTime #37748

Closed
wants to merge 1 commit into from
Closed

Conversation

ianfiske
Copy link
Contributor

@mschauer
Copy link
Contributor

mschauer commented Sep 29, 2020

Should adapt the doc string and widen the definition of the scope (perhaps “a number l” instead of “a floating point number”) introducing a fallback isnan(::Number) = false

@mschauer
Copy link
Contributor

If widening isnan to number-likes is not welcomed, a local solution would be

x -> x isa AbstractFloat ? isnan(x) : false

but that would break code for x which aren't AbstractFloats but could be NaN-likes, for example NaN with units.

@nalimilan
Copy link
Member

At #35989 I also felt that the absence of an isnan(::Number) fallback was a problem to write generic code.

But I don't think adding isnan(::TimePeriod) is the good fix for https://github.com/JuliaLang/Statistics.jl/issues/53, as we will keep getting an error for other types which don't define it. And if we do that manually for all types, we'd better define isnan(::Any) = false -- which would be inconsistent with iszero.

Can't we just check applicable or method_exists before calling isnan in quantile?

@ianfiske
Copy link
Contributor Author

Good point @nalimilan -- I've opened https://github.com/JuliaLang/Statistics.jl/pull/54 instead. Closing this.

@ianfiske ianfiske closed this Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot compute quantile(x::Array{Millisecond,1})
3 participants