Version: 2.0.4 (using KDE 3.5.4, Gentoo) Compiler: Target: i686-pc-linux-gnu OS: Linux (i686) release 2.6.17-gentoo-r7 kcalc cmp function only compliments lower 32-bits. Basically kcalc has supported > 32-bits for a while, it seems that CMP is a function is did not transition correctly. steps to reproduce: open kcalc set to hex mode enter: FFFFFFFFFFFFFFFF hit cmp result is: FFFFFFFF00000000 should be: 0000000000000000 hitting cmp again confirms the behaviour by toggling the lower 32-bits back to F's I recognize that since kcalc now attempts aribtrary precision, defining cmp is tough (how many F's to we append to the end since a positive nubmer basically has infinite 0's...) Well the "correct" solution is not to litterally compliment, but instead take advantage of 2's compliment notation: CMP in 2's compliment is exactly equivalent to negating the value then subtracting 1 for example: 4d2 hex (1234 in decimal) has the following value when complimented: 0xFFFFFFFFFFFFFB2D (-1235 in decimal) so to properly implement CMP with arbitrary precision, simply negate the value, then subtract one from that. Obviously the result will be truncated in HEX view since that mode can only display 64-bits, but it will be correct. This should work correctly regardless of the number of bits supported and is trivial to implement. Evan Teran
in a related bug: kcalc can be made to display "nan" with a cmp operation (no reason why this should be). steps to reproduce: open kcalc set to decimal enter: 1235 hit the inverse sign button switch to hex mode (display now shows 0xFFFFFFFFFFFFFB2D) switch to decimal mode (display now shows -1235) hit cmp display shows "nan" should be 1234 Evan Teran
Hi Evan, Thank you very much for reporting again a bug (and for providing a solution). I believe I have fixed this now in the cvs-trunk (both for KDE-3.5.5 and for KDE-4.0). I hope the time will arrive, when Hex will finally work without any bug in KCalc. :-( Best Klaus
Seems to be fixed. Klaus