Bug 502849

Summary: Applying x! to a non-integer number gives a wrong result
Product: [Applications] kcalc Reporter: Alex <aleksej.rukin>
Component: generalAssignee: Evan Teran <evan.teran>
Status: RESOLVED DUPLICATE    
Severity: normal CC: gabriel.barrantes.dev
Priority: NOR    
Version First Reported In: 24.12.3   
Target Milestone: ---   
Platform: FreeBSD Ports   
OS: FreeBSD   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alex 2025-04-15 16:45:38 UTC
Applying "x!" to a non-integer positive number (e. g. 2.5!) gives an incorrect result, the factorial of the integer part (in this case 2). Factorials of non-integer numbers must either be calculated using the gamma function, n! = Γ(n+1), or throw an error message if this is impossible to implement.
https://en.wikipedia.org/wiki/Gamma_function
PS, applying x! to an integer negative number must always throw an error, the gamma function (therefore, the factorial as well) is undefined at these points.
Comment 1 Antonio Rojas 2025-04-15 20:36:01 UTC

*** This bug has been marked as a duplicate of bug 501399 ***