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
weightedAvg throws "index out of bounds" exception #94
Comments
I agree library function should not throw out of bounds access errors. They aren't more helpful than dreaded Situation with mean is little trickier. Mean is not defined for empty sample so we have to either throw error for empty sample or wrap result in Maybe or add define result for empty sample. Both |
Same applies for quantiles, they're not defined for an empty input. I guess the ideal solution would indeed be to wrap everything in |
I'm closing this in favor of #100. Problem with weightedAvg is fixed and other issue is more general |
When
weightedAvg
is called on an empty vector the following exception is thrown:Unfortunately most input errors seem to be handling with exceptions. To be nice to the user, the error could be made more explicit:
mean
andwelfordMean
returnNaN
and0
resp. on empty input. Would that be a solution? Either way, it would be good to document which parameters can be used such that the user can be extra careful.The text was updated successfully, but these errors were encountered: