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

Make func stat.combin.factorial public and protect against overflow #1858

Open
rpoe opened this issue Apr 1, 2023 · 1 comment
Open

Make func stat.combin.factorial public and protect against overflow #1858

rpoe opened this issue Apr 1, 2023 · 1 comment

Comments

@rpoe
Copy link

rpoe commented Apr 1, 2023

What are you trying to do?

I'm working on combinatorics and permutations. I need the function factorial in my software.

What did you try?

use factorial.

How does Gonum not allow you to achieve your goal?

The function is declared private.
And it has a bug: it permits computation of factorials over 20. Range overflow without panic.

What version of Go and Gonum are you using?

v0.12.0

Is this feature absent from the current master?

no

Are you able to help contribute the feature?

I like to implement this extension.
This will be my first contribution to Gonum. so please be lenient. Thanks.

@kortschak
Copy link
Member

What is the use case here? For a "safe" generalised implementation of factorial arbitrary width integers are needed and this is out of scope for Gonum. The factorial function here is internal for cases that are likely to have in-bound inputs, though we should probably test and document its limits.

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