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 Scoring.factorial(int) return long #116

Merged
merged 2 commits into from
Apr 5, 2022
Merged

Make Scoring.factorial(int) return long #116

merged 2 commits into from
Apr 5, 2022

Conversation

InkerBot
Copy link
Contributor

@InkerBot InkerBot commented Feb 3, 2022

Fix #54

@InkerBot
Copy link
Contributor Author

InkerBot commented Feb 3, 2022

#109 should be close if merge this

@@ -12,6 +12,8 @@

public static final int MIN_GUESSES_BEFORE_GROWING_SEQUENCE = 10000;

public static final long JS_NUMBER_MAX = 9007199254740992L;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@InkerBot Sorry for the late reply. JS_NUMBER_MAX is JavaScript's Number.MAX_SAFE_INTEGER, right? The following documentation seems to indicate that 9007199254740991 (9007199254740991L) is the correct value.

The Number.MAX_SAFE_INTEGER constant represents the maximum safe integer in JavaScript (2^53 - 1).

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER

@InkerBot InkerBot requested a review from vvatanabe April 4, 2022 11:31
if (n < 2) return 1;
int f = 1;
if (n > 19) return JS_NUMBER_MAX;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes:
n is 18 => 6402373705728000
JS_NUMBER_MAX => 9007199254740991
n is 19 => 121645100408832000

@vvatanabe
Copy link
Member

@InkerBot Thanks!

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.

Score from Strength.getScore() returns 0 for some long complex passwords
2 participants