TheAlgorithms/C-Sharp

Factorial.cs

deljohnson1 opened this issue · 6 comments

The Algorithms.Numeric.Factorial.Calculate function takes an int as input and returns a long; the function will overflow with an input greater than 20. Calculate should take a BigInteger as input and return one as output.

Additionally, the function checks input for less than zero. I would recommend putting input error checking outside of the Calculate function, in the ap[plications code (not the library), so that iterative functions that call it don't take the performance hit. In this case I would merely state it in the comment.

I have made the change in my test environment and it appears the change only breaks the Maclaurin.cs file; the fix for this appears to be to perform explicit type conversion on the return result.

I can submit the corrections if desired.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Is this issue closed ? I can take it up if not complete.

It's being worked on in #390

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

This issue was closed because it has been stalled for 7 days with no activity.