?Return type of primorial (similar to factorial) applied to Int? #2843
Replies: 3 comments 2 replies
-
|
No replies after 3 weeks? Perhaps we were all busy with other more pressing matters. |
Beta Was this translation helpful? Give feedback.
-
|
I can add some simple arg checks. It is a little odd that |
Beta Was this translation helpful? Give feedback.
-
|
Should be fixed |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
primorial(n)returns the product of all primes up ton(incl.). The on-line manual reports that it acceptsIntandZZRingElemare argument types. When called with a "large"Intvalue, it computes the answer, and then triggers an error when trying to convert the answer toInt. Why does it want to convert the answer toInt?The Julia function
factorialalso "overflows" if the given argument is a "large"Int(on my computer "large" means greater than 20). Personally I find this restriction quite unnatural, but the design is imposed on us by Julia. Do we really want to mimic this restriction for the functionprimorial? Why?In case anyone is interested:
primorialgives error on my computer if the argument isIntgreater than 52. If we do preserve this behaviour then this should be made clear in the documentation.Beta Was this translation helpful? Give feedback.
All reactions