Skip to content

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