# Binary Arithmetic - in 8-bit addition, do I discard remaining no's

Page 1 of 1

## 3 Replies - 4435 Views - Last Post: 31 July 2012 - 05:09 AM

### #1 TechSyndrome

Reputation: 3
• Posts: 135
• Joined: 06-May 12

# Binary Arithmetic - in 8-bit addition, do I discard remaining no's

Posted 29 July 2012 - 08:25 AM

For example:

As you can see, I have '1' (circled in red), left over. Because my aim is to get 8-bits for a two's complement question, do I just discard this? I just want to make sure that I am doing this the correct way. Would appreciate any help on this.

This post has been edited by TechSyndrome: 29 July 2012 - 08:26 AM

Is This A Good Question/Topic? 0

## Replies To: Binary Arithmetic - in 8-bit addition, do I discard remaining no's

### #2 sepp2k

• D.I.C Lover

Reputation: 2277
• Posts: 3,507
• Joined: 21-June 11

## Re: Binary Arithmetic - in 8-bit addition, do I discard remaining no's

Posted 29 July 2012 - 08:56 AM

Yes, when performing arithmetic on fixed-width n-bit integers, you discard any bits that carry over to the n+1st bit.

In effect this means that arithmetic with n-bit (unsigned) integers is equivalent to regular arithmetic modulo 2n.

### #3 TechSyndrome

Reputation: 3
• Posts: 135
• Joined: 06-May 12

## Re: Binary Arithmetic - in 8-bit addition, do I discard remaining no's

Posted 29 July 2012 - 08:57 AM

sepp2k, on 29 July 2012 - 08:56 AM, said:

Yes, when performing arithmetic on fixed-width n-bit integers, you discard any bits that carry over to the n+1st bit.

In effect this means that arithmetic with n-bit (unsigned) integers is equivalent to regular arithmetic modulo 2n.

Thank you. Appreciate it.

### #4 cfoley

• Cabbage

Reputation: 2238
• Posts: 4,716
• Joined: 11-December 07

## Re: Binary Arithmetic - in 8-bit addition, do I discard remaining no's

Posted 31 July 2012 - 05:09 AM

Yup, that's right. The Z80 chip also has a carry flag which would be set in those circumstances. I assume modern processors have an equivalent.