Bug 513520 - Double factorial support
Summary: Double factorial support
Status: ASSIGNED
Alias: None
Product: kcalc
Classification: Applications
Component: general (other bugs)
Version First Reported In: 25.12.0
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Evan Teran
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-18 03:55 UTC by cirnos
Modified: 2025-12-19 17:22 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cirnos 2025-12-18 03:55:50 UTC
SUMMARY
KCalc should support double factorials, as it currently calculates them as (x!)! instead.

STEPS TO REPRODUCE
1. Calculate 7!!

OBSERVED RESULT
Result is (7!)!

EXPECTED RESULT
Result is 7!!, or 105

SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: N/A
KDE Frameworks Version: N/A
Qt Version: N/A

ADDITIONAL INFORMATION
None.
Comment 1 ajay 2025-12-19 15:24:29 UTC
Hi! I am a student and new to KDE development. I would like to try implementing this double factorial (!!) feature. I plan to investigate the knumber logic and the parser to see how to handle the double exclamation mark. If I get stuck, I will let you know so someone else can take over.
Comment 2 Gabriel Barrantes 2025-12-19 16:57:58 UTC
(In reply to ajay from comment #1)
> Hi! I am a student and new to KDE development. I would like to try
> implementing this double factorial (!!) feature. I plan to investigate the
> knumber logic and the parser to see how to handle the double exclamation
> mark. If I get stuck, I will let you know so someone else can take over.

Seems that GNU GMP actually implements mpz_2fac_ui, seems that is the function you a looking for, follow/copy any other function implementation (factorial would be ideal) code to implement this new function. Start in the KNumber library.
Comment 3 Bug Janitor Service 2025-12-19 17:22:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kcalc/-/merge_requests/207