Declare factorial as returning a float in order to fix issue 74 #75
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It works perfectly fine to have the factorial function in Scorer.php to be declared as returning a float.
This results in the same output as before, and extends the code to work with longer strings.
It is valid because the value of
$pi
is a float and it will cause the value of$g
to become a float no matter if factorial returns an int or a float. I hope I am not being too lazy or naive here.Note that if you use really really huge passwords you can exceed runtime limits, but that is another issue, out of scope here.
You can experiment with
ulimit -t 300
if you wish.Proposed fix for #74