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

Fixes #52 (infinite loop for fractional numbers) #53

Conversation

markus-willems
Copy link
Contributor

I added a check for fractional numbers to the permutation function:

if (nelem % 1 !== 0) throw new RangeError;

It (P function line 26) would otherwise enter an infinite loop for e.g. nelem = 1.5.

I added tests for this case, too.

@dankogai could you please review this PR? Thanks! ☺️

@markus-willems
Copy link
Contributor Author

markus-willems commented Nov 9, 2018

I have just noticed it's the same for combination. I will add a check and test for that, too.

Going to close this PR for now.

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.

1 participant