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

Math.NET behaviour for INFINITY values #98

Closed
troublescooter opened this issue May 27, 2019 · 2 comments
Closed

Math.NET behaviour for INFINITY values #98

troublescooter opened this issue May 27, 2019 · 2 comments

Comments

@troublescooter
Copy link
Collaborator

What is the reason for adopting this odd behaviour? It seems to me that the most sensible thing to do would be to return 0 if shape isn't NaN or (+-)INFINITY. This is just one instance, as there seem to be a couple of other odd return values.

    impl Mean<f64> for Gamma {
    /// Returns the mean of the gamma distribution
    ///
    /// # Remarks
    ///
    /// Returns `shape` if `rate == f64::INFINITY`. This behavior
    /// is borrowed from the Math.NET implementation
    ///
    /// # Formula
    ///
    /// ```ignore
    /// α / β
    /// ```
    ///
    /// where `α` is the shape and `β` is the rate
@boxtown
Copy link
Collaborator

boxtown commented May 27, 2019

A lot of these as indicated by the doc-string were borrowed behavior from Math.NET but I agree that not all of this behavior is necessarily correct. Looking through the commits of the Math.NET source I don't see a good reason for this particular method to not return 0, I'm happy to accept any PRs addressing this and other odd behavior you've seen

@troublescooter
Copy link
Collaborator Author

Fixed in #116

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

No branches or pull requests

2 participants