Closed ghost closed 1 year ago
Either implement the extended definition of factorial for real numbers using Gamma function
we have that already: gamma(…)
.
or simply spit out an error if the input is not a non-negative integer.
That's probably a good idea, yes.
This is now fixed in Numbat. You can try it online here: https://numbat.dev/?q=%28-3%29%21
The standard definition of factorial only deals with non-negative integers. If you decided to implement only it then you should give errors when the users tried to calculate factorial of real numbers. The current behavior is you rounded the real number to the nearest integer and returned the factorial of this integer instead. For example,
pi!
will be calculated as4!
,e!
will be calculated as3!
. This is wrong. Either implement the extended definition of factorial for real numbers using Gamma function or simply spit out an error if the input is not a non-negative integer.