https://issues.dlang.org/show_bug.cgi?id=13371
--- Comment #4 from [email protected] --- (In reply to Don from comment #2) > Exactly! And I seriously doubt that factorial is commonly used. I don't agree. I am using it. It's a basic common algorithm. Asking people to rewrite it in every little script of project is unwise. Python standard library shows it's a good idea to put it in. Other languages like Julia have it in the std lib. > Eg even for calculating permutations and combinations, using factorial is > not a good method. This is not important. > And for BigInt, iterated multiplication isn't a good way of caclulating > factorials. Right, for BigInt you can add a different specialization later for bigints. > You need to group multiple factors together, so that the > multiplies are of similar length. There are good algorithms to compute large factorials quickly. But having a basic common algorithm is right. > And finally, your code reports factorial(2) == 3, which isn't a good start, I haven't tested it, it's just example code to show what I meant. --
