-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
help wantedIndicates that a maintainer wants help on an issue or pull requestIndicates that a maintainer wants help on an issue or pull request
Description
Factorial returns a wrong result for all Int64 integers bigger than 20, due to overflow.
julia> factorial(21)
-4249290049419214848
I suggest converting the argument to BigInt if it is an Int64 bigger than 20, or at least
returning a warning that the result is wrong.
It seems that factorial convert other number types like Int32 or Int8 to Int64 if there is an overflow for these types, so that handling Int64 should be sufficient to handle all non-Bool Integer types.
Metadata
Metadata
Assignees
Labels
help wantedIndicates that a maintainer wants help on an issue or pull requestIndicates that a maintainer wants help on an issue or pull request