does not handle conversion of negative decimal numbers to binary correctly (twos complement form).

Bug #151676 reported by James Ronald
6
Affects Status Importance Assigned to Milestone
gcalctool (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: gcalctool

gcalctool does not handle conversion of negative decimal numbers to binary correctly (twos complement form). For instance -1 decimal converted to a 16 bit binary would be 1111111111111111; similarly -128 would be 10000000. See the stupid windows calculator as it does the conversion correctly.

Thanks
James Ronald

ProblemType: Bug
Architecture: i386
Date: Thu Oct 11 15:32:28 2007
DistroRelease: Ubuntu 7.04
ExecutablePath: /usr/bin/gcalctool
Package: gcalctool 5.9.14-0ubuntu1
PackageArchitecture: i386
ProcCmdline: gcalctool
ProcCwd: /home/jronald
ProcEnviron:
 SHELL=/bin/bash
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=en_US.UTF-8
SourcePackage: gcalctool
Uname: Linux jronald-desktop 2.6.20-16-generic #2 SMP Sun Sep 23 19:50:39 UTC 2007 i686 GNU/Linux

Revision history for this message
James Ronald (jronald) wrote :
Revision history for this message
James Ronald (jronald) wrote :

Sorry, should be; similarly -128 would be 1111111110000000.

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

Works fine for me (AMD64):

&16 -128 ) Bin -> 1111111110000000
&16 -1 ) Bin -> 1111111111111111

Anyone else on i386 with the same problem?

Changed in gcalctool:
status: New → Incomplete
Revision history for this message
Cesare Tirabassi (norsetto) wrote :

Just tested on an i386 with the same (correct) results.
Can you please tell us what result you get and how?

Revision history for this message
Claude (clauder) wrote :

I am on i386.

When I have -1 in decimal and click to hexadecimal, the result stays at -1. I search for a twos complement mode but could not find anything.

I am not if this is a bug or my lack of understanding how to do twos complement (btw, I am using 64 integer).

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

Can you try with the above keys combination?

Revision history for this message
Claude (clauder) wrote :

Ok, now I get the same thing. I just did not understood what you meant. But I am using u64.....

But, how to do the opposite? I.e. go from an hex twos complement to a signed decimal?

Changed in gcalctool:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.