Bug 502849 - Applying x! to a non-integer number gives a wrong result
Summary: Applying x! to a non-integer number gives a wrong result
Status: RESOLVED DUPLICATE of bug 501399
Alias: None
Product: kcalc
Classification: Applications
Component: general (show other bugs)
Version: 24.12.3
Platform: FreeBSD Ports FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Evan Teran
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-15 16:45 UTC by Alex
Modified: 2025-04-15 20:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***