Monash University >
School
of Computer Science and Software Engineering >
CSE1303 >
Part B >
Lectures > Lecture B03 notes
CSE1303 Computer Science
Semester 2, 2003
Part B
Lecture B03 notes: Signed integers
In this lecture
- Hand addition
- Sum
- Carry
- Addition in base 10
- Addition in base 2
- Overflow
- Subtraction
- Borrow
- Can result in negative numbers
- Signed integers
- A number that may be positive or negative
- Representation schemes
- Signed magnitude
- Two's complement
- Range of signed integers (n bits)
- Smallest value: 10000... (value -2n-1)
- Largest value: 01111... (value +2n-1-1)
- C signed integer types
- signed char (8 bits)
- short (usually 16 bits)
- long (usually 32 bits)
- long long (usually 64 bits)
- int (usually 16 or 32 bits)
- Sign bit (MSB)
- 0 means zero or positive
- 1 means negative
- Converting to binary
- Flip-and-add-one technique
- Converting from binary
- Signed addition
- Signed subtraction
- Binary multiplication
[ Top |
Home ]
Last modified 2002-12-04