Created attachment 152697 [details] Kalk History of Recent Bad Math SUMMARY When I use Kalk, I get bad math results sometimes. See attached screenshot. STEPS TO REPRODUCE 1. Install Kalk Flatpak. 2. Do math. 3. Get weird results. OBSERVED RESULT Not exact result. Lots of unnecessary decimal places due to result reported. EXPECTED RESULT Exact result when doing math. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Fedora 36 KDE Spin KDE Plasma Version: 5.25.5 KDE Frameworks Version: 5.98.0 Qt Version: 5.15.6 ADDITIONAL INFORMATION Kalk is the Flathub version. ABOUT says Calculator 22.09. It would be nice to have a KDE calculator identical to the Windows 10/11 Calculator App which is one program I do miss from Windows.
Git commit 6d7498b88ab84811607ad30138cffacea38cbf2b by Han Young. Committed on 12/10/2022 at 13:59. Pushed by hanyoung into branch 'master'. use mpfr_init2 to ensure the precision isn't lost on string to float conversion M +13 -13 knumber/knumber_float.cpp https://invent.kde.org/plasma-mobile/kalk/commit/6d7498b88ab84811607ad30138cffacea38cbf2b
Turns out string to knumber's float variant conversion uses GNU MPFR's old init function, thus lost the precision from user input to internal representation. I changed the init function to "mpfr_init2" with 1024 bit precision. Should be fixed now. A similar change will be applied to KCalc, since that's where Kalk's knumber from. :)
Thanks! I'll wait for the update to come from Flathub.