> Okay, I found a logic problem as well.  This is weird because I remember
> doing this in C and it worked.
> 
> ex:
> 
> UInt x = 2;
> UInt y = 4;
> UInt z;
> 
> z = x - y;
> 
> Now it would be a -2 except for the fact it's an Unsigned Integer.... thus
> it should be 2.  What I get from my application is 65534, which is roughly
> the maximum value of an int type... am I correct?
> 
> How come it isn't a 2?

  <put on lecturer hat>
  -2 is in binary 1111111111111110 :)

  now, since you are dealing with an UNSIGNED integer, it converts this
  binary representation into the equivilant integer representation, which
  is where your 65534 comes from.

  -2 is not 2 when it is unsigned :) it is 65534 :P
  </put on lecturer hat>

  cheers.

az
--
Aaron Ardiri 
Java Certified Programmer      http://www.hig.se/~ardiri/
University-College i G�vle     mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN       
Tel: +46 26 64 87 38           Fax: +46 26 64 87 88
Mob: +46 70 656 1143           A/H: +46 8 668 78 72

if you enjoy it, then it aint work :) - rule #106 of life


--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to