-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Problem with factorial function #166
Labels
bug
Something isn't working
Comments
-5! is like -(5!), but you are right, (-5)! gives -120 instead of NaN |
But it does this in any case even if the -5 is a result of a previous operation |
Also if you type (5)! it will give you 5. Probably related. For some reason, when there are parentheses before the ! symbol, the code doesn't reach the factorial function. |
I fixed factoriel of 0 |
Done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
If I try to do the factorial of a negative number instead of giving me Nan as result it give the factorial of the number as it was a positive number but negative, for example if try to do -5! it give me -120.
And I also wanted to report that instead of giving Nan as it's currently written in the code 0! should give as a result 1.
https://www.thoughtco.com/why-does-zero-factorial-equal-one-3126598
To Reproduce
Steps to reproduce the behavior:
Expected behavior
-5! should give me as a result Nan
Screenshots/videos
https://media.discordapp.net/attachments/831525884069675067/1076231040437342319/IMG_20230217_205730.jpg
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: