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> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Fedora RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Patch made from svn for KDE-3.5.4
Fix? |
Description
Gilboa Davara
2006-09-07 18:39:13 UTC
Steps 1-4 work fine here (32 bit system), but 5-8 give the wrong answer (0x7FFFFFFFFFFFFC0). 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 Klaus, Can you attach a patch? I'll add it to the kdebase RPM patch-list, rebuild and test the fix. - Gilboa Created attachment 17806 [details]
Patch made from svn for KDE-3.5.4
I hope this helps.
Klaus
Seems to be fixed. 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 I tested Klaus' latest patch and the bug seems to have been resolved. Thanks. - Gilboa Marking as resolved. 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 This works fine for me in kcalc 3.5.5 from Debian 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
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 Happy to help. Thanks for the fix. |