Shop OBEX P1 Docs P2 Docs Learn Events
Difference between Add and Adds — Parallax Forums

Difference between Add and Adds

James NewmanJames Newman Posts: 133
edited 2009-01-03 21:43 in Propeller 1
What's the difference? The manual says that the prop stores signed numbers as two's complements... so aren't all the arithmetic operations the same for unsigned or signed numbers? If I'm thinking right, the only difference should be in display and comparing. Someone fill me in.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-03 21:34
    The difference between the signed and unsigned arithmetic operations is in the definition of the C flag.

    The unsigned ADD puts the carry into the C flag while the signed ADDS puts a signed overflow into the C flag.
    Similarly, SUB puts the borrow into the C flag while the SUBS puts a signed underflow into the C flag.
  • James NewmanJames Newman Posts: 133
    edited 2009-01-03 21:43
    Ahh, thanks. Well now the question seems silly.... tongue.gif

    Thanks for the quick response, means I can get on with what I was doing.
Sign In or Register to comment.