home | list info | list archive | date index | thread index

[OCLUG-Tech] Double checking re: twos complement & and signed types ??

  • Subject: [OCLUG-Tech] Double checking re: twos complement & and signed types ??
  • From: William Case <billlinux [ at ] rogers [ dot ] com>
  • Date: Sat, 15 Sep 2007 12:23:04 -0400
Hi;

Just double checking because the manuals I have are somewhat ambiguous
-- trying to be all things to all people.

Given that I am using an AMD Athalon 64 x2 CPU:

(N.B. I do not need an explanation of twos complement.  I thing I got
it.)

1) All the texts I read say something like "If you are using a two's
complement system" and go on to leave other explanatory statements open
ended.  I have no choice do I ?  Twos complement is part of the
architecture of the ALU is it not? 

2) This as been answered for me before, but so much is written about
signed numbers, I would like to re-check.  Using C programming, my
system would not need or use signed numbers (integer and floating point)
would it?  The concern over signed/unsigned numbers is only if there
exists the possibility that the C program might be later used on a
system that requires signed/unsigned numbers -- right?

3) Using an operator is a distinct instruction -- isn't it?  I.e 
int num1 = 23
int num2 = -11
int result = num1 - num2 
printf("%d",result)
$ 34

int result = num1 + num2
printf("%d",result)
$ 12

Writing and viewing the above code is trivial.  I am trying to confirm
that subtracting a negatively signed integer (or floating point) is
*always* a double negative resulting in addition.

I have pages of explanations.  What I don't have is a friend in the next
cubical I can ask "This means, what I think it means; doesn't it?"
 
-- 
Regards Bill