|Summary:||kcalc produces wrong DEC to HEX conversion in 64bit math.|
|Product:||[Applications] kcalc||Reporter:||Gilboa Davara <gilboad>|
|Component:||general||Assignee:||Klaus Niederkrüger <kniederk>|
|Latest Commit:||Version Fixed In:|
Patch made from svn for KDE-3.5.4
Description Gilboa Davara 2006-09-07 18:39:13 UTC
Version: 3.5.4-2.0 (KDE-RedHat RPMs) (using KDE KDE 3.5.4) Installed from: Fedora RPMs Compiler: gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1) OS: Linux Steps to reproduce: 1. Open kcalc in decimal mode. 2. 2 ^ 59 3. Returns: 576460752303423488 4. Switch to hex: Expected result: 0x800000000000000 Actual result: 0x1000000000000000 Just to verify: 5. Switch back to decimal. 6. Subtract 1. 7. Returns: 576460752303423487 8. Switch to hex. Expected result: 0x7FFFFFFFFFFFFFF Actual result: 0x1000000000000000 Decimal math seems to be OK. Decimal to Hex conversion seems to be broken. (32bit only?) FYI: FC5/x86_64 - Gilboa
Comment 1 Philip Rodrigues 2006-09-08 16:10:57 UTC
Steps 1-4 work fine here (32 bit system), but 5-8 give the wrong answer (0x7FFFFFFFFFFFFC0).
Comment 2 Klaus Niederkrüger 2006-09-17 13:08:16 UTC
I believe I have fixed this now in the cvs-trunk (both for KDE-3.5.5 and for KDE-4.0). Please test this, if you have time! Thank you for reporting this bug!!! Klaus
Comment 3 Gilboa Davara 2006-09-17 13:14:24 UTC
Klaus, Can you attach a patch? I'll add it to the kdebase RPM patch-list, rebuild and test the fix. - Gilboa
Comment 4 Klaus Niederkrüger 2006-09-17 13:37:21 UTC
Created attachment 17806 [details] Patch made from svn for KDE-3.5.4 I hope this helps. Klaus
Comment 5 Klaus Niederkrüger 2006-09-19 11:47:16 UTC
Seems to be fixed.
Comment 6 Gilboa Davara 2006-09-19 13:00:33 UTC
No go. I took the patch and applied it against 3.5.4 1. Open kcalc in decimal mode. 2. 2 ^ 59 3. Returns: 576460752303423488 4. Switch to hex: Expected result: 0x800000000000000 Actual result: 0x4000000000000000 5. Switched back to decimal. Expected result: 576460752303423488 Actual result: 9223372036854775808 Any chance this fix requires 3.5.5? - Gilboa
Comment 7 Gilboa Davara 2006-09-23 11:04:34 UTC
I tested Klaus' latest patch and the bug seems to have been resolved. Thanks. - Gilboa
Comment 8 Gilboa Davara 2006-09-23 11:05:13 UTC
Marking as resolved.
Comment 9 Gilboa Davara 2006-09-23 11:15:04 UTC
Spoke too soon. I took the patch and applied it against 3.5.4 1. Open kcalc in decimal mode. 2. 2 ^ 59 3. Returns: 576460752303423488 4. Switch to hex, result: 0x800000000000000 (OK). 5. Switched back to decimal, substract 1. 6. Returns: 576460752303423487 (OK). 7. Switch back to hex: Expected result: 0x7FFFFFFFFFFFFFFF Actual result: 0x8000000000000000 - Gilboa
Comment 10 Josh Metzler 2006-11-10 03:06:30 UTC
This works fine for me in kcalc 3.5.5 from Debian
Comment 11 Gilboa Davara 2006-12-06 10:51:52 UTC
Created attachment 18813 [details] Fix? Klaus, This patch seems to solve the problem. It's based around your patch. (I just added the x86_64 ifdef) As expected in 64bit sizeof(long long int) == sizeof(long). (Unless you're using Windows...) Thanks, and sorry for taking my sweet time testing your fix ;) - Gilboa
Comment 12 Klaus Niederkrüger 2007-01-03 01:26:24 UTC
This bug seems to have been finally fixed. Thanks Gilboa (and after your wish in your last email, I started to read things on wikipedia. I learned something new. Interesting.). Klaus
Comment 13 Gilboa Davara 2007-01-03 11:30:56 UTC
Happy to help. Thanks for the fix.